Part Number Hot Search : 
SAB80 IN74HC 8ZETE1 150EBU04 C78L27CD N4007 BC247B E1A102MR
Product Description
Full Text Search
 

To Download STM32W108CCU75TR Datasheet File

  If you can't view the Datasheet, Please click here to try to view without PDF Reader .  
 
 


  Datasheet File OCR Text:
  this is information on a product in full production. september 2013 docid16252 rev 15 1/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz high-performance, ieee 802.15.4 wireless system-on-chip with up to 256 kbytes of embedded flash memory datasheet - production data features ? complete system-on-chip ? 32-bit arm ? cortex?-m3 processor ? 2.4 ghz ieee 802.15.4 transceiver & lower mac ? 128/192/256-kbyte flash, 8/12/16-kbyte ram memory ? aes128 encryption accelerator ? flexible adc, spi/uart/i 2 c serial communications, and general-purpose timers ? 24 highly configurable gpios with schmitt trigger inputs ? industry-leading arm? cortex?-m3 processor ? leading 32-bit processing performance ? highly efficient thumb ? -2 instruction set ? operation at 6, 12 or 24 mhz ? flexible nested vectored interrupt controller ? low power consumption, advanced management ? receive current (w/ cpu): 27 ma ? transmit current (w/ cpu, +3 dbm tx): 31 ma ? low deep sleep current, with retained ram and gpio: 400 na/800 na with/without sleep timer ? low-frequency internal rc oscillator for low-power sleep timing ? high-frequency internal rc oscillator for fast (100 s) processor start-up from sleep ? exceptional rf performance ? normal mode link budget up to 102 db; configurable up to 107 db ? -99 dbm normal rx sensitivity; configurable to -100 dbm (1% per, 20 byte packet) ? +3 db normal mode output power; configurable up to +8 dbm ? robust wifi and bluetooth coexistence ? innovative network and processor debug ? non-intrusive hardware packet trace ? serial wire/jtag interface ? standard arm debug capabilities: flash patch & breakpoint; data watchpoint & trace; instrumentation trace macrocell ? ? application flexibility ? single voltage operation: 2.1-3.6 v with internal 1.8 v and 1.25 v regulators ? optional 32.768 khz crystal for higher timer accuracy ? low external component count with single 24 mhz crystal ? support for external power amplifier ? small 7x7 mm 48-pin vfqfpn package or 6x6 mm 40-pin vfqfpn package applications ? smart energy ? building automation and control ? home automation and control ? security and monitoring ? zigbee? pro wireless sensor networking ? rf4ce products and remote controls vfqfpn48 (7 x 7 mm) vfqfpn40 (6 x 6 mm) ufqfpn48 (7 x 7 mm) www.st.com
contents stm32w108hb stm32w108cc stm32w108cb stm32w108cz 2/285 docid16252 rev 15 contents 1 description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14 1.1 development tools . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 1.2 overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.2.1 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16 1.2.2 arm ? cortex?-m3 core . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 2 documentation conventions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 3 pinout and pin description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 4 embedded memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.1 memory organization and memory map . . . . . . . . . . . . . . . . . . . . . . . . . . 31 4.2 flash memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 4.3 random-access memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4.3.1 direct memory access (dma) to ram . . . . . . . . . . . . . . . . . . . . . . . . . . 36 4.3.2 ram memory protection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 4.3.3 memory controller . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 37 4.3.4 memory controller registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 38 4.4 memory protection unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 42 5 radio frequency module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 5.1 receive (rx) path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 5.1.1 rx baseband . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 5.1.2 rssi and cca . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 5.2 transmit (tx) path . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 5.2.1 tx baseband . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 5.2.2 tx_active and ntx_active signals . . . . . . . . . . . . . . . . . . . . . . . . . 44 5.3 calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 5.4 integrated mac module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 44 5.5 packet trace interface (pti) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 5.6 random number generator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 45 6 system modules . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46
docid16252 rev 15 3/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz contents 9 6.1 power domains . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 6.1.1 internally regulated power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 6.1.2 externally regulated power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 47 6.2 resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 6.2.1 reset sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 48 6.2.2 reset recording . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 49 6.2.3 reset generation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 6.2.4 reset register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 6.3 clocks . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 6.3.1 high-frequency inte rnal rc oscillator (hsi) . . . . . . . . . . . . . . . . . . . . . . 54 6.3.2 high-frequency crystal oscillator (hse osc) . . . . . . . . . . . . . . . . . . . . 54 6.3.3 low-frequency internal rc oscillator (lsi10k) . . . . . . . . . . . . . . . . . . . 54 6.3.4 low-frequency crystal oscilla tor (lse osc) . . . . . . . . . . . . . . . . . . . . . 54 6.3.5 clock switching . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 6.3.6 clock switching registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 56 6.4 system timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 6.4.1 mac timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 6.4.2 watchdog timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 6.4.3 sleep timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 63 6.4.4 event timer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 6.4.5 slow timer (mac timer, watchdog, and sleeptimer) control and status registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 64 6.5 power management . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 6.5.1 wake sources . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 73 6.5.2 basic sleep modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 6.5.3 further options for deep sleep . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 6.5.4 use of debugger with sleep modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . 76 6.5.5 power management registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77 6.6 security accelerator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88 7 integrated voltage regulator . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 8 general-purpose input/out put . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 8.1 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 8.1.1 gpio ports . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 92 8.1.2 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 8.1.3 forced functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94
contents stm32w108hb stm32w108cc stm32w108cb stm32w108cz 4/285 docid16252 rev 15 8.1.4 reset . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 8.1.5 nbootmode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 8.1.6 gpio modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 95 8.1.7 wake monitoring . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 8.2 external interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97 8.3 debug control and status . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 8.4 gpio alternate functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 8.5 general-purpose input/output (gpio) registers . . . . . . . . . . . . . . . . . . . 100 8.5.1 port x configuration register (low) (gpiox_crl) . . . . . . . . . . . . . . . . 100 8.5.2 port x configuration register (high) (g piox_crh) . . . . . . . . . . . . . . . 101 8.5.3 port x input data register (gpiox_idr) . . . . . . . . . . . . . . . . . . . . . . . . 102 8.5.4 port x output data register (gpiox_odr) . . . . . . . . . . . . . . . . . . . . . . 102 8.5.5 port x output set register (gpiox_bsr) . . . . . . . . . . . . . . . . . . . . . . . 103 8.5.6 port x output clear register (gpiox_brr) . . . . . . . . . . . . . . . . . . . . . . 103 8.5.7 external interrupt pending register (ext i_pr) . . . . . . . . . . . . . . . . . . 104 8.5.8 external interrupt x trig ger selection register (extix_tsr) . . . . . . . . . 104 8.5.9 external interrupt x configuration regist er (extix_cr) . . . . . . . . . . . . 105 8.5.10 pc trace or debug select regist er (gpio_pctracecr) . . . . . . . . 105 8.5.11 gpio debug configuration register (gpio_dbgcr) . . . . . . . . . . . . . . 106 8.5.12 gpio debug status register (gpio_dbgsr) . . . . . . . . . . . . . . . . . . . 106 8.5.13 general-purpose input/output (gpio) r egister map . . . . . . . . . . . . . . . 107 9 serial interfaces . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 9.1 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 109 9.2 configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .110 9.3 spi master mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 9.3.1 setup and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 9.3.2 operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 9.3.3 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 114 9.4 spi slave mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .115 9.4.1 setup and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 9.4.2 operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 9.4.3 dma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 117 9.4.4 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 9.5 inter-integrated circuit interfaces (i2c) . . . . . . . . . . . . . . . . . . . . . . . . . . .118 9.5.1 setup and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119
docid16252 rev 15 5/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz contents 9 9.5.2 constructing frames . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 9.5.3 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 9.6 universal asynchronous receiver/transmitte r (uart) . . . . . . . . . . . . . . 122 9.6.1 setup and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 9.6.2 fifos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 9.6.3 rts/cts flow control . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 9.6.4 dma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 9.6.5 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 126 9.7 direct memory access (dma) channels . . . . . . . . . . . . . . . . . . . . . . . . . 126 9.8 serial controller common registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 9.8.1 serial controller interrupt status regist er (scx_isr) . . . . . . . . . . . . . . 128 9.8.2 serial controller interrupt enable regist er (scx_ier) . . . . . . . . . . . . . . 130 9.8.3 serial controller interrupt control regi ster 1 (scx_icr) . . . . . . . . . . . . 132 9.8.4 serial controller data register (scx_dr) . . . . . . . . . . . . . . . . . . . . . . . 133 9.8.5 serial controller control register 2 (scx_cr) . . . . . . . . . . . . . . . . . . . . 133 9.8.6 serial controller clock rate register 1 (scx_crr1) . . . . . . . . . . . . . . . 134 9.8.7 serial controller clock rate register 2 (scx_crr2) . . . . . . . . . . . . . . . 134 9.9 serial controller: serial peripheral interface (spi) registers . . . . . . . . . . 135 9.9.1 serial controller spi status register (scx_spisr) . . . . . . . . . . . . . . . . 135 9.9.2 serial controller spi control register (scx_spicr) . . . . . . . . . . . . . . . 136 9.10 serial controller: inter-integrated circuit (i2c) registers . . . . . . . . . . . . . 137 9.10.1 serial controller i2c status register (scx_i2csr) . . . . . . . . . . . . . . . . 137 9.10.2 serial controller i2c control register 1 (scx_i2ccr1) . . . . . . . . . . . . 138 9.10.3 serial controller i2c control register 2 (scx_i2ccr2) . . . . . . . . . . . . 139 9.11 serial controller: universal asynchronous receiver/ transmitter (uart) registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 140 9.11.1 serial controller uart status regist er (sc1_uartsr) . . . . . . . . . . . 140 9.11.2 serial controller uart control regist er (sc1_uartcr) . . . . . . . . . . . 141 9.11.3 serial controller uart baud rate register 1 (sc1_uartbrr1) . . . . . 142 9.11.4 serial controller uart baud rate register 2 (sc1_uartbrr2) . . . . . 143 9.12 serial controller: direct memory access (dma) registers . . . . . . . . . . . . 144 9.12.1 serial controller receive dma begin address channel a register (scx_dmarxbegaddar) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 9.12.2 serial controller receive dm a end address channel a register (scx_dmarxendaddar) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 144 9.12.3 serial controller receive dma begin address channel b register (scx_ dmarxbegaddbr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145
contents stm32w108hb stm32w108cc stm32w108cb stm32w108cz 6/285 docid16252 rev 15 9.12.4 serial controller receive dm a end address channel b register (scx_dmarxendaddbr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 145 9.12.5 serial controller transmit dm a begin address channel a register (scx_dmatxbegaddar) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 9.12.6 serial controller transmit dma end address channel a register (scx_dmatxendaddar) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 146 9.12.7 serial controller transmit dm a begin address channel b register (scx_dmatxbegaddbr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 9.12.8 serial controller transmit dma end address channel b register (scx_dmatxendaddbr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 147 9.12.9 serial controller receive dma counter channel a register (scx_dmarxcntar) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 9.12.10 serial controller receiv e dma count channel b register (scx_dmarxcntbr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 148 9.12.11 serial controller transmit dma counter register (scx_dmatxcntr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 149 9.12.12 serial controller dma status register (scx_dmasr) . . . . . . . . . . . . . 150 9.12.13 serial controller dma co ntrol register (scx_dmacr) . . . . . . . . . . . . . 152 9.12.14 serial controller receive dm a channel a first error register (scx_dmarxerrar) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 9.12.15 serial controller receive dm a channel b first error register (scx_dmarxerrbr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 153 9.12.16 serial controller receive dma saved counter channel b register (scx_dmarxcntsavedr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 9.12.17 serial interface (sc1/sc2) register map . . . . . . . . . . . . . . . . . . . . . . . 154 10 general-purpose timers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 159 10.1 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 10.1.1 time-base unit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 10.1.2 counter modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 10.1.3 clock selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 169 10.1.4 capture/compare channels . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 10.1.5 input capture mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 174 10.1.6 pwm input mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 10.1.7 forced output mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 10.1.8 output compare mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 176 10.1.9 pwm mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 10.1.10 one-pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180 10.1.11 encoder interface mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 182 10.1.12 timer input xor function . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 184
docid16252 rev 15 7/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz contents 9 10.1.13 timers and external trigger synchronizat ion . . . . . . . . . . . . . . . . . . . . 185 10.1.14 timer synchronization . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189 10.1.15 timer signal descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 10.2 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 10.3 general-purpose timers 1 and 2 registers . . . . . . . . . . . . . . . . . . . . . . . 196 10.3.1 timer x interrupt and status register (t imx_isr) . . . . . . . . . . . . . . . . . 196 10.3.2 timer x interrupt missed register (tim x_missr) . . . . . . . . . . . . . . . . . 197 10.3.3 timer x interrupt enable register (timx_ ier) . . . . . . . . . . . . . . . . . . . . 197 10.3.4 timer x control register 1 (timx_cr1) . . . . . . . . . . . . . . . . . . . . . . . . . 198 10.3.5 timer x control register 2 (timx_cr2) . . . . . . . . . . . . . . . . . . . . . . . . . 200 10.3.6 timer x slave mode control register (timx_smcr) . . . . . . . . . . . . . . . 201 10.3.7 timer x event generation register (timx_ egr) . . . . . . . . . . . . . . . . . . 204 10.3.8 timer x capture/compare mode register 1 (timx_ccmr1) . . . . . . . . . 205 10.3.9 timer x capture/compare mode register 2 (timx_ccmr2) . . . . . . . . . 209 10.3.10 timer x capture/compare enable register (timx_ccer) . . . . . . . . . . . 213 10.3.11 timer x counter register (timx_cnt) . . . . . . . . . . . . . . . . . . . . . . . . . 214 10.3.12 timer x prescaler register (timx_psc) . . . . . . . . . . . . . . . . . . . . . . . . 214 10.3.13 timer x auto-reload register (timx_arr) . . . . . . . . . . . . . . . . . . . . . . 215 10.3.14 timer x capture/compare 1 register (timx_ccr1) . . . . . . . . . . . . . . . 215 10.3.15 timer x capture/compare 2 register (timx_ccr2) . . . . . . . . . . . . . . . 216 10.3.16 timer x capture/compare 3 register (timx_ccr3) . . . . . . . . . . . . . . . 216 10.3.17 timer x capture/compare 4 register (timx_ccr4) . . . . . . . . . . . . . . . 217 10.3.18 timer 1 option register (tim1_or) . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 10.3.19 timer 2 option register (tim2_or) . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 10.3.20 general-purpose timers 1 and 2 (tim1/tim2) register map . . . . . . . . 219 11 analog-to-digital converter . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 11.1 functional description . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 11.1.1 setup and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 11.1.2 gpio usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 11.1.3 voltage reference . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 11.1.4 offset/gain correction . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 11.1.5 dma . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 225 11.1.6 adc configuration register . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 11.1.7 operation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 11.1.8 calibration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 229 11.2 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 231
contents stm32w108hb stm32w108cc stm32w108cb stm32w108cz 8/285 docid16252 rev 15 11.3 analog-to-digital converter (adc) registers . . . . . . . . . . . . . . . . . . . . . . 232 11.3.1 adc interrupt status register (adc_isr) . . . . . . . . . . . . . . . . . . . . . . 232 11.3.2 adc interrupt enable register (adc_ier) . . . . . . . . . . . . . . . . . . . . . . 232 11.3.3 adc control register (adc_cr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 11.3.4 adc offset register (adc_offsetr) . . . . . . . . . . . . . . . . . . . . . . . . . 234 11.3.5 adc gain register (adc_gainr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . 234 11.3.6 adc dma control register (adc_dmacr) . . . . . . . . . . . . . . . . . . . . . 235 11.3.7 adc dma status register (adc_dmasr) . . . . . . . . . . . . . . . . . . . . . . 235 11.3.8 adc dma memory start address register (adc_dmamsar) . . . . . . 236 11.3.9 adc dma number of data to transf er register (adc_dmandtr) . . . 236 11.3.10 adc dma memory next address re gister (adc_dmamnar) . . . . . . 237 11.3.11 adc dma count number of data transferred register (adc_dmacndtr) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237 11.3.12 analog-to-digital converter (adc) regist er map . . . . . . . . . . . . . . . . . . 238 12 interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 12.1 nested vectored interrupt controller (nvic) . . . . . . . . . . . . . . . . . . . . . . 240 12.2 management interrupt registers . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 242 12.2.1 management interrupt source register (mgmt_isr) . . . . . . . . . . . . . 242 12.2.2 management interrupt mask register (m gmt_ier) . . . . . . . . . . . . . . . 243 12.2.3 management interrupt (mgmt) register m ap . . . . . . . . . . . . . . . . . . . 243 13 debug support . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 13.1 stm32w108 jtag tap connection . . . . . . . . . . . . . . . . . . . . . . . . . . . 245 14 electrical characteristi cs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 14.1 parameter conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 14.1.1 minimum and maximum values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 14.1.2 typical values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 14.1.3 typical curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 14.1.4 loading capacitor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 14.1.5 pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 14.2 absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 14.3 operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 14.3.1 general operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 14.3.2 operating conditions at power-up . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 14.3.3 absolute maximum ratings (electrical sens itivity) . . . . . . . . . . . . . . . . 249
docid16252 rev 15 9/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz contents 9 14.4 spi interface characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 14.5 adc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 14.6 clock frequencies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 14.6.1 high frequency internal clock characterist ics . . . . . . . . . . . . . . . . . . . . 258 14.6.2 high frequency external clock characteristics . . . . . . . . . . . . . . . . . . . 258 14.6.3 low frequency internal clock characterist ics . . . . . . . . . . . . . . . . . . . . 259 14.6.4 low frequency external clock characteristics . . . . . . . . . . . . . . . . . . . 259 14.7 dc electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 14.8 digital i/o specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 14.9 non-rf system electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . 266 14.10 rf electrical characte ristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 14.10.1 receive . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 14.10.2 transmit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 14.10.3 synthesizer . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 15 package characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 16 ordering information scheme . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 274 17 revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
list of tables stm32w108hb stm32w108cc stm32w108cb stm32w108cz 10/285 docid16252 rev 15 list of tables table 1. description of abbreviations used for bit field access . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18 table 2. pin descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 table 3. stm32w108xx peripheral register boundary addresse s . . . . . . . . . . . . . . . . . . . . . . . . . . 34 table 4. flash memory . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 35 table 5. mem register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41 table 6. generated resets . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 50 table 7. rst register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 2 table 8. system clock modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 table 9. clk register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6 2 table 10. mactmr, wdg, and slptmr register map and re set values . . . . . . . . . . . . . . . . . . . . . 72 table 11. pwr register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8 6 table 12. 1.8 v integrated voltage regulator specifications . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 89 table 13. gpio configuration modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 table 14. timer 2 output configuration controls . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 93 table 15. gpio forced functions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 94 table 16. irqc/d gpio selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 table 17. gpio signal assignments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 98 table 18. gpio register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 107 table 19. sc1 gpio usage and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 table 20. sc2 gpio usage and configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 111 table 21. spi master gpio usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112 table 22. spi master mode formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 113 table 23. spi slave gpio usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 115 table 24. spi slave mode formats . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 116 table 25. i2c master gpio usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 118 table 26. i2c clock rate programming . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 119 table 27. i2c master frame segments . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 120 table 28. uart gpio usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 122 table 29. uart baud rate divisors for common baud rates. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 123 table 30. uart rts/cts flow control configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 125 table 31. sc1/sc2 register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 154 table 32. timer gpio use . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 161 table 33. extrigsel clock signal selection . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 1 table 34. counting direction versus encoder signals . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 183 table 35. timer signal descriptions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 195 table 36. tim1/tim2 register map and rese t values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 219 table 37. adc gpio pin usage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 224 table 38. adc inputs . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 226 table 39. typical adc input configurations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 227 table 40. adc sample times . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 228 table 41. adc gain and offset correction equations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 230 table 42. adc register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23 8 table 43. nvic exception table . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 240 table 44. mgmt register map and reset values . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 243 table 45. voltage characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 table 46. current characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 table 47. thermal characteristics. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 247 table 48. general operating conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248
docid16252 rev 15 11/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz list of tables 11 table 49. por hv thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 table 50. por lvcore thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 table 51. por lvmem thresholds . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 248 table 52. reset filter specification for rstb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 249 table 53. esd absolute maximum ratings . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 9 table 54. electrical sensitivities . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 250 table 55. spi characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 251 table 56. adc module key parameters for 1 mhz sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 254 table 57. adc module key parameters for input buffer disabled and 6 mhz sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 255 table 58. adc module key parameters for input buffer enabled and 6mhz sampling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 256 table 59. adc characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 257 table 60. high-frequency rc oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 table 61. high-frequency cr ystal oscillator characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 258 table 62. low-frequency rc oscillator characte ristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 table 63. low-frequency crystal oscillator ch aracteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 259 table 64. dc electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 260 table 65. digital i/o characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 265 table 66. non-rf system electrical characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 table 67. receive characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 266 table 68. transmit characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 267 table 69. synthesizer characteristics . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 268 table 70. vfqfpn48 7x7mm package mechanical data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 270 table 71. vfqfpn40 6x6mm package mechanical data. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 table 72. ufqfpn48 ?7x7 mm pitch 0.5 package mechanical data . . . . . . . . . . . . . . . . . . . . . . . . 273 table 73. document revision history . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 276
list of figures stm32w108hb stm32w108cc stm32w108cb stm32w108cz 12/285 docid16252 rev 15 list of figures figure 1. stm32w108 block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 figure 2. 48-pin vfqfpn pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 figure 3. 40-pin vfqfpn pinout . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 figure 4. stm32w108xb memory mapping . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 figure 5. stm32w108cc and stm32w108cz memory mapping . . . . . . . . . . . . . . . . . . . . . . . . . . 33 figure 6. system module block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 46 figure 7. clocks block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 53 figure 8. power management state diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 75 figure 9. gpio block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 91 figure 10. serial controller block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 110 figure 11. i2c segment transitions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 figure 12. uart character frame format . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 figure 13. uart fifos . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 124 figure 14. rts/cts flow control connections . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 25 figure 15. general-purpose timer block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 160 figure 16. counter timing diagram with prescaler division change from 1 to 4 . . . . . . . . . . . . . . . . . 162 figure 17. counter timing diagram, intern al clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 163 figure 18. counter timing diagram, intern al clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 figure 19. counter timing diagram, update event when arpe = 0 (timx_arr not buffered) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 164 figure 20. counter timing diagram, update event when arpe = 1 (timx_arr buffered) . . . . . . . . 165 figure 21. counter timing diagram, intern al clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 figure 22. counter timing diagram, intern al clock divided by 4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 166 figure 23. counter timing diagram, in ternal clock divided by 1, timx_arr = 0x6 . . . . . . . . . . . . . . 167 figure 24. counter timing diag ram, update event with arpe = 1 (counter underflow) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 figure 25. counter timing diag ram, update event with arpe = 1 (counter overflow) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 168 figure 26. control circuit in normal mode, internal clock divided by 1 . . . . . . . . . . . . . . . . . . . . . . . 169 figure 27. ti2 external clock connection ex ample. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 0 figure 28. control circuit in external clock mode 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 70 figure 29. external trigger input block . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171 figure 30. control circuit in external clock mode 2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 172 figure 31. capture/compare channel (example: channel 1 input stage) . . . . . . . . . . . . . . . . . . . . . 172 figure 32. capture/compare channel 1 main circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 173 figure 33. output stage of capture/comp are channel (channel 1). . . . . . . . . . . . . . . . . . . . . . . . . . . 173 figure 34. pwm input mode timing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 175 figure 35. output compare mode, toggle on oc1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 177 figure 36. edge-aligned pwm waveforms (arr = 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 178 figure 37. center-aligned pwm waveforms (a rr = 8) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 179 figure 38. example of one pulse mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 181 figure 39. example of counter operation in encoder interf ace mode . . . . . . . . . . . . . . . . . . . . . . . . 183 figure 40. example of encoder interface mode with ic1fp1 polarity inverted . . . . . . . . . . . . . . . . . 184 figure 41. control circuit in reset mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 185 figure 42. control circuit in gated mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 186 figure 43. control circuit in trigger mode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 187 figure 44. control circuit in external clock mode 2 + trig ger mode . . . . . . . . . . . . . . . . . . . . . . . . . 188 figure 45. master/slave timer example . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 189
docid16252 rev 15 13/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz list of figures 13 figure 46. gating timer 2 with oc1ref of timer 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 190 figure 47. gating timer 2 with enable of timer 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1 91 figure 48. triggering timer 2 with update of timer 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19 2 figure 49. triggering timer 2 with enable of timer 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 193 figure 50. triggering timers 1 and 2 with timer 1 ti1 input . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194 figure 51. adc block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 223 figure 52. swj block diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 244 figure 53. pin loading conditions . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 figure 54. pin input voltage . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 246 figure 55. spi timing diagram - slave mode and cpha = 0 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 figure 56. spi timing diagram - slave mode and cpha = 1 (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 252 figure 57. spi timing diagram - master mode (1) . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 253 figure 58. transmit power consumption . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 263 figure 59. transmit output power . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 264 figure 60. vfqfpn48 7x7mm package outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 269 figure 61. vfqfpn48 7x7mm recommended footprint (dimens ions in mm) . . . . . . . . . . . . . . . . . . 270 figure 62. vfqfpn40 6x6mm pitch 0.5 package outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 271 figure 63. ufqfpn48 7x7 mm pitch 0.5 package outline . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 272 figure 64. ufqfpn48 7x7 mm recommended footprint (dim ensions in mm) . . . . . . . . . . . . . . . . . . 273
description stm32w108hb stm32w108cc stm32w108cb stm32w108cz 14/285 docid16252 rev 15 1 description the stm32w108 is a fully int egrated system-on-chip that integrates a 2.4 ghz, ieee 802.15.4-compliant transceiver, 32-bit arm? cortex?-m3 micropro cessor, flash and ram memory, and peripherals of use to designers of 802.15.4-based systems. the transceiver utilizes an efficient archit ecture that exceeds the dynamic range requirements imposed by the ieee 802.15.4-2003 standard by over 15 db. the integrated receive channel filterin g allows for robust co-existence with other communication standards in the 2.4 ghz spectrum, such as ieee 802.11 an d bluetooth. the inte grated regulator, vco, loop filter, and power amplifier keep the external component count low. an optional high performance radio mode (boost mode) is software-selectable to boost dynamic range. the integrated 32-bit arm? cortex?-m3 micr oprocessor is highly optimized for high performance, low power consum ption, and efficient memory utilization. including an integrated mpu, it supports two differen t modes of operation: privileged mode and unprivileged mode. this architecture could be used to separate the networking stack from the application code and prevent unwanted modification of restricted areas of memory and registers resulting in incr eased stability and reliabilit y of deployed solutions. the stm32w108 has 128/192/256 kbytes of embedded flash memory and 8/12/16 kbytes of integrated ram for data and program storage. the stm32w108 hal software employs an effective wear-leveling algorithm that optimizes the lifetime of the embedded flash. to maintain the strict timing requirements imposed by the zigbee and ieee 802.15.4-2003 standards, the stm32w108 integrates a number of mac functions into the hardware. the mac hardware handles automatic ack transmission and reception, automatic backoff delay, and clear channel assessment for transmission, as well as automatic filtering of received packets. a packet trace interface is also integrated with the mac, allowing complete, non-intrusive capture of all packets to and from the stm32w108. the stm32w108 offers a number of advanced power management features that enable long battery life. a high -frequency internal rc oscillator a llows the processor core to begin code execution quickly upon waking. various deep sleep modes are available with less than 1 a power consumption while retaining ram contents. to support user-defined applications, on-chip peripherals include uart, spi, i 2 c, adc and general-purpose timers, as well as up to 24 gpios. additionally, an integrated voltage regulator, power-on-reset circuit, and sleep timer are available.
docid16252 rev 15 15/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz description 281 1.1 development tools the stm32w108 implements both the arm serial wire and jtag debug interfaces. these interfaces provide real time, non-intrusive programming and de bugging capabilities. serial wire and jtag provide the same functionality, but are mutually exclusive. the serial wire interface uses two pins; the jtag interface uses five. serial wire is preferred, since it uses fewer pins. the stm32w108 also integrates the standard arm system debug components: flash patch and breakpoint (fpb), data watchpoint and trace (dwt), and instrumentation trace macrocell (dwt). figure 1. stm32w108 block diagram packet sniffer adc rf_p,n program flash 128 kbytes 192 kbytes 256 kbytes data sram 8 kbytes 12 kbytes 16 kbytes hf crystal osc lf crystal osc general purpose adc serial wire and jtag debug internal lf rc-osc gpio multiplexor swtich chip manage r regulator bias 2 nd level interrupt controller rf_tx_alt_p,n pa[7:0], pb[7:0], pc[7:0] encryption acclerator if always powered domain arm cortex-m3 ? cpu with nvic and mpu vreg_out watchdog pa select lna pa pa dac mac + baseband sleep timer bias_r por nreset general purpose timers gpio registers uart/ spi/i 2 c synth internal hf rc-osc tx_active swclk, jtck calibration adc packet trace cpu debug tpiu/itm/ fpb/dwt ai15250 osc_out osc_in
description stm32w108hb stm32w108cc stm32w108cb stm32w108cz 16/285 docid16252 rev 15 1.2 overview 1.2.1 functional description the stm32w108 radio receiver is a low-if, super-heterodyne receiver. the architecture has been chosen to optimize co-existence wit h other devices in the 2.4 ghz band (namely, wifi and bluetooth), and to minimize power co nsumption. the receiver uses differential signal paths to reduce sensitivity to noise interference. fo llowing rf amplification, the signal is downconverted by an image-rejecting mixer, filtered, and then digitized by an adc. the radio transmitter uses an efficient archit ecture in which the data stream directly modulates the vco frequency. an integrated power amplifier (pa) provides the output power. digital logic controls tx path and ou tput power calibration. if the stm32w108 is to be used with an external pa, use the tx_act ive or ntx_active si gnal to control the timing of the external switching logic. the integrated 4.8 ghz vco and loop filter minimize off-chip circuitry. only a 24 mhz crystal with its loading capacitors is required to establish the pll local oscillator signal. the mac interfaces the on-chip ram to t he rx and tx baseband modules. the mac provides hardware-based ieee 802.15.4 packet-l evel filtering. it supplies an accurate symbol time base that minimizes the synchronizati on effort of the software stack and meets the protocol timing requirements. in addition, it provides timer and synchronization assistance for the ieee 80 2.15.4 csma-ca algorithm. the stm32w108 integrates an arm? cortex -m3 microprocessor, revision r1p1. this industry-leading core provides 32 bit perfo rmance and is very power efficient. it has excellent code density using the arm? thumb 2 instruction set. the processor can be operated at 12 mhz or 24 mhz when using the crystal oscillato r, or at 6 mhz or 12 mhz when using the integrated high frequency rc oscillator. the stm32w108 has 128/192/256 kbytes of flash memory, 8/12/16 kbytes of sram on- chip, and the arm configurable me mory protection unit (mpu). the stm32w108 contains 24 gpio pins shared with other peripheral or alternate functions. because of flexible routing within the stm32w 108, external devices can use the alternate functions on a variety of different gpios. the integrated serial controller sc1 can be configured for spi (master or slave), i 2 c (master-only), or uart operation, and the serial controller sc2 can be configured for spi (master or slave) or i 2 c (master-only) operation. the stm32w108 has a general purpose adc which can sample analog signals from six gpio pins in single-ended or differential modes. it can also sample the regulated supply vdd_padsa, the voltage reference vref, and gnd. the adc has two selectable voltage ranges: 0 v to 1.2 v for the low voltage (input buffer disabled) and 0.1 v to vdd_pads minus 0.1 v for the high voltage supply (input buffer enabled). the adc has a dma mode to capture samples and automatically transfer them into ram. the integrated voltage reference for the adc, vref, can be made ava ilable to external circuitry. an external voltage reference can also be driven into the adc. the stm32w108 contains four oscillators: a high frequency 24 mhz external crystal oscillator (24 mhz hse osc), a high frequency 12 mhz internal rc oscillator (12 mhz hsi rc), an optional low frequency 32.768 khz exte rnal crystal oscillator (32 khz hse osc), and a 10 khz internal rc oscillator (10 khz lsi rc).
docid16252 rev 15 17/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz description 281 the stm32w108 has an ultra low power, deep sleep state with a choice of clocking modes. the sleep timer can be clocked wi th either the extern al 32.768 khz crystal oscillator or with a 1 khz clock derived from the internal 10 khz lsi rc oscillator. alternatively, all clocks can be disabled for the lowest power mode. in the lowest power mode, only external events on gpio pins will wake up the chip. the stm32w10 8 has a fast startup time (typically 100 s) from deep sleep to the execution of the first arm? cortex-m3 instruction. the stm32w108 contains three power domains. the always-on high voltage supply powers the gpio pads and critical chip func tions. regulated low voltage supplies power the rest of the chip. the low voltage supplies are be disabled during deep sleep to reduce power consumption. integrated voltage regulators generate regulated 1.25 v and 1.8 v voltages from an unregulated supply voltage. the 1.8 v regulator output is decoupled and routed externally to supply analog blocks, ram, and flash memories. the 1.25 v regulator output is decoupled externally and supplies the core logic. the digital section of the rece iver uses a coherent demodula tor to generate symbols for the hardware-based mac. the digital receiver also contains the analog radio calibration routines and controls the gain within the receiver path. in addition to 2 general-purpose timers, the st m32w108 also contains a watchdog timer to ensure protection against software crashes a nd cpu lockup, a 32-bit sleep timer dedicated to system timing and waking from sleep at specific times and an arm? standard system event timer in the nvic. the stm32w108 integrates hardware support for a packet trace module, which allows robust packet-based debug. note: the stm32w108 is not pin-compatible with the previous generation chip, the sn250, except for the rf section of the chip. pins 1- 11 and 45-48 are compatible, to ease migration to the stm32w108. 1.2.2 arm ? cortex?-m3 core the stm32w108 integrates the arm ? cortex?-m3 microprocessor, revision r1p1, developed by arm ltd, making the stm32w108 a true system-on-a-chip solution. the arm ? cortex-m3 is an advanced 32-bit modified harvard architecture processor that has separate internal program and data buses, but presents a unified program and data address space to software. the word width is 32 bits for both the program and data sides. the arm ? cortex-m3 allows unaligned word and half-word data accesses to support efficiently-packed data structures. the arm ? cortex-m3 clock speed is configurable to 6 mhz, 12 mhz, or 24 mhz. for normal operation 12 mhz is preferred over 24 mhz du e to its lower power consumption. the 6 mhz operation can only be used when radio operati ons are not required since the radio requires an accurate 12 mhz clock. the arm ? cortex-m3 in the stm32w108 has also been enhanced to support two separate memory protection levels. basic protection is available without using the mpu, but the usual operation uses the mpu. the mpu protects unimplemented areas of the memory map to prevent common software bugs from interfering with software operation. the architecture could also separate the networking stack from the application code us ing a fine granularity ram protection module. errant writes are c aptured and details are reported to the developer to assist in tracking down and fixing issues.
documentation conventions stm32w108hb stm32w108cc stm32w108cb stm32w108cz 18/285 docid16252 rev 15 2 documentation conventions table 1. description of abbrevia tions used for bit field access abbreviation description (1) 1. the conditions under which the hardware (core) sets or clears this field are expl ained in details in the bit field description, as well as the events that may be generated by writing to the bit. read/write (rw) software can read and write to these bits. read-only (r) software can only read these bits. write only (w) software can only write to this bit. reading returns the reset value. read/write in (mpu) privileged mode only (rws) software can read and write to these bits only in privileged mode. for more information, please refer to ram memory protection on page 37 and memory protection unit on page 42 .
docid16252 rev 15 19/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz pinout and pin description 281 3 pinout and pin description figure 2. 48-pin vfqfpn pinout ai15261 ground pad on back vdd_24mhz rf_p rf_n vdd_rf rf_tx_alt_p rf_tx_alt_n vdd_if bias_r vdd_padsa pc5, tx_active vdd_pads pa1, tim2c3, sc2sda, sc2miso pa0, tim2c1, sc2mosi pa7, tim1c4, reg_en vdd_core vreg_out pc6, osc32_in, ntx_active vdd_pads pa2, tim2c4, sc2scl, sc2sclk pb0, vref, irqa, traceclk, tim1clk, tim2msk pc4, jtms, swdio pc3, jtdi pc2, jtdo, swo swclk, jtck vdd_pads pa5, adc5, pti_data, nbootmode, tracedata3 pa4, adc4, pti_en, tracedata2 pa3, sc2nssel, traceclk, tim2c2 pc1, adc3, swo, tracedata0 vdd_mem pb7, adc2, irqc, tim1c2 pb5, adc0, tim2clk, tim1msk vdd_core vdd_pre osc_out pc0, jrst, irqdn, tracedata1 osc_in vdd_pads 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 36 35 34 33 32 31 30 29 28 27 26 25 48 47 46 45 44 43 42 41 40 39 38 37 vdd_vco nreset pc7, osc32_out, osc32_ext pb3, tim2c3, sc1ncts, sc1sclk pb4, tim2c4, sc1nrts, sc1nssel pb1, sc1miso, sc1mosi, sc1sda, sc1txd, tim2c1 pa6, tim1c3 pb2, sc1miso, sc1mosi, sc1scl, sc1rxd, tim2c2 vdd_synth pb6, adc1, irq6, tim1c1
pinout and pin description stm32w108hb stm32w108cc stm32w108cb stm32w108cz 20/285 docid16252 rev 15 figure 3. 40-pin vfqfpn pinout ai15260 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 ground pad on back vdd_vco rf_p rf_n vdd_rf rf_tx_alt_p rf_tx_alt_n vdd_if bias_r vdd_padsa pc5, tx_active vdd_pads pa1, tim2c3, sc2sda, sc2miso pa0, tim2c1, sc2mosi pb4, tim2c4, sc1nrts, sc1nssel pb3, tim2c3, sc1ncts, sc1sclk vdd_core vreg_out nreset vdd_pads pa2, tim2c4, sc2scl, sc2sclk pc4, jtms, swdio pc3, jtdi pc2, jtdo, swo swclk, jtck pb2, sc1miso, sc1mosi, sc1scl, sc1rxd, tim2c2 pb1, sc1miso, sc1mosi, sc1sda, sc1txd, tim2c1 vdd_pads pa5, adc5, pti_data, nbootmode, tracedata3 pa4, adc4, pti_en, tracedata2 pa3, sc2nssel, traceclk, tim2c2 vdd_mem pc0, jrst, irqdn, tracedata1 pb7, adc2, irqc, tim1c2 pb6, adc1, irq6, tim1c1 vdd_core vdd_pre osc_out vdd_24mhz osc_in pc1, adc3, swo, tracedata0 table 2. pin descriptions 48-pin package pin no. 40-pin package pin no. signal direction description 1 40 vdd_24mhz power 1.8v high-frequency oscillator supply 2 1 vdd_vco power 1.8v vco supply 3 2 rf_p i/o differential (with rf_n) receiver input/transmitter output 4 3 rf_n i/o differential (with rf_p ) receiver input/transmitter output 5 4 vdd_rf power 1.8v rf supply (lna and pa) 6 5 rf_tx_alt_p o differential (with rf_tx_ alt_n) transmitter output (optional) 7 6 rf_tx_alt_n o differential (with rf_tx_ alt_p) transmitter output (optional) 8 7 vdd_if power 1.8v if supply (mixers and filters) 9 8 bias_r i bias setting resistor
docid16252 rev 15 21/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz pinout and pin description 281 10 9 vdd_padsa power analog pad supply (1.8v) 11 10 pc5 i/o digital i/o tx_active o logic-level control for external rx/tx switch. the stm32w108 baseband controls tx_active and drives it high (vdd_pads) when in tx mode. select alternate output f unction with gpioc_crh[7:4] 12 11 nreset i active low chip reset (inter nal pull-up) 13 pc6 i/o digital i/o osc32_in i/o 32.768 khz crystal oscillator select analog function with gpioc_crh[11:8] ntx_active o inverted tx_active signal (see pc5) select alternate output func tion with gpioc_crh[11:8] 14 pc7 i/o digital i/o osc32_out i/o 32.768 khz crystal oscillator. select analog function with gpioc_crh[15:12] osc32_ext i digital 32 khz clock input source 15 12 vreg_out power regulator output (1.8 v while awake, 0 v during deep sleep) 16 13 vdd_pads power pads supply (2.1-3.6 v) 17 14 vdd_core power 1.25 v digital core supply decoupling 18 pa7 i/o high current digital i/o. disable reg_en with gpio_dbgcr[4] tim1_ch4 o timer 1 channel 4 output enable timer output with tim1_ccer select alternate output func tion with gpioa_crh[15:12] disable reg_en wi th gpio_dbgcr[4] i timer 1 channel 4 input. (cannot be remapped.) reg_en o external regulator open dr ain output. (enabled after reset.) table 2. pin descriptions (continued) 48-pin package pin no. 40-pin package pin no. signal direction description
pinout and pin description stm32w108hb stm32w108cc stm32w108cb stm32w108cz 22/285 docid16252 rev 15 19 15 pb3 i/o digital i/o tim2_ch3 (see pin 22) o timer 2 channel 3 output enable remap wit h tim2_or[6] enable timer output in tim2_ccer select alternate output f unction with gpiob_crl[15:12] i timer 2 channel 3 input. en able remap with tim2_or[6]. uart_cts i uart cts handshake of serial controller 1 enable with sc1_uartcr[5] select uart with sc1_cr sc1sclk o spi master clock of serial controller 1 either disable timer output in tim2_ccer or disable remap with tim2_or[6] enable master wit h sc1_spicr[4] select spi with sc1_cr select alternate output f unction with gpiob_crl[15:12] i spi slave clock of serial controller 1 enable slave with sc1_spicr[4] select spi with sc1_cr 20 16 pb4 i/o digital i/o tim2_ch4 (see also pin 24) o timer 2 channel 4 output enable remap wit h tim2_or[7] enable timer output in tim2_ccer select alternate output f unction with gpiob_crh[3:0] i timer 2 channel 4 input. en able remap with tim2_or[7]. uart_rts o uart rts handshake of serial controller 1 either disable timer output in tim2_ccer or disable remap with tim2_or[7] enable with sc1_uartcr[5] select uart with sc1_cr select alternate output f unction with gpiob_crh[3:0] sc1nssel i spi slave select of serial controller 1 enable slave with sc1_spicr[4] select spi with sc1_cr table 2. pin descriptions (continued) 48-pin package pin no. 40-pin package pin no. signal direction description
docid16252 rev 15 23/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz pinout and pin description 281 21 17 pa0 i/o digital i/o tim2_ch1 (see also pin 30) o timer 2 channel 1 output disable remap wit h tim2_or[4] enable timer output in tim2_ccer select alternate output f unction with gpioa_crl[3:0] i timer 2 channel 1 input. dis able remap with tim2_or[4]. sc2mosi o spi master data out of serial controller 2 either disable timer output in tim2_ccer or enable remap with tim2_or[4] enable master wit h sc2_spicr[4] select spi with sc2_cr select alternate output f unction with gpioa_crl[3:0] i spi slave data in of serial controller 2 enable slave with sc2_spicr[4] select spi with sc2_cr 22 18 pa1 i/o digital i/o tim2_ch3 (see also pin 19) o timer 2 channel 3 output disable remap wit h tim2_or[6] enable timer output in tim2_ccer select alternate output f unction with gpioa_crl[7:4] i timer 2 channel 3 input. dis able remap with tim2_or[6]. sc2sda i/o i 2 c data of serial controller 2 either disable timer output in tim2_ccer or enable remap with tim2_or[6] select i 2 c with sc2_cr select alternate open-dr ain output function with gpioa_crl[7:4] sc2miso o spi slave data out of serial controller 2 either disable timer output in tim2_ccer or enable remap with tim2_or[6] enable slave with sc2_spicr[4] select spi with sc2_cr select alternate output f unction with gpioa_crl[7:4] i spi master data in of serial controller 2 enable slave with sc2_spicr[4] select spi with sc2_cr 23 19 vdd_pads power pads supply (2.1-3.6v) table 2. pin descriptions (continued) 48-pin package pin no. 40-pin package pin no. signal direction description
pinout and pin description stm32w108hb stm32w108cc stm32w108cb stm32w108cz 24/285 docid16252 rev 15 24 20 pa2 i/o digital i/o tim2_ch4 (see also pin 20) o timer 2 channel 4 output disable remap wit h tim2_or[7] enable timer output in tim2_ccer select alternate output f unction with gpioa_crl[11:8] i timer 2 channel 4 input. dis able remap with tim2_or[7]. sc2scl i/o i 2 c clock of serial controller 2 either disable timer output in tim2_ccer or enable remap with tim2_or[7] select i 2 c with sc2_cr select alternate open-dr ain output function with gpioa_crl[11:8] sc2sclk o spi master clock of serial controller 2 either disable timer output in tim2_ccer or enable remap with tim2_or[7] enable master wit h sc2_spicr[4] select spi with sc2_cr select alternate output f unction with gpioa_crl[11:8] i spi slave clock of serial controller 2 enable slave with sc2_spicr[4] select spi with sc2_cr 25 21 pa3 i/o digital i/o sc2nssel i spi slave select of serial controller 2 enable slave with sc2_spicr[4] select spi with sc2_cr traceclk (see also pin 36) o synchronous cpu trace clock either disable timer output in tim2_ccer or enable remap with tim2_or[5] enable trace interface in arm core select alternate output f unction with gpioa_crl[15:12] tim2_ch2 (see also pin 31) o timer 2 channel 2 output disable remap wit h tim2_or[5] enable timer output in tim2_ccer select alternate output f unction with gpioa_crl[15:12] i timer 2 channel 2 input. dis able remap with tim2_or[5]. table 2. pin descriptions (continued) 48-pin package pin no. 40-pin package pin no. signal direction description
docid16252 rev 15 25/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz pinout and pin description 281 26 22 pa4 i/o digital i/o adc4 analog adc input 4. select analog function with gpioa_crh[3:0]. pti_en o frame signal of packet trace interface (pti). disable trace interface in arm core. select alternate output f unction with gpioa_crh[3:0]. tracedata2 o synchronous cpu trace data bit 2. select 4-wire synchronous tr ace interface in arm core. enable trace interface in arm core. select alternate output f unction with gpioa_crh[3:0]. 27 23 pa5 i/o digital i/o adc5 analog adc input 5. select analog function with gpioa_crh[7:4]. pti_data o data signal of packet trace interface (pti). disable trace interface in arm core. select alternate output f unction with gpioa_crh[7:4]. nbootmode i embedded serial bootloader activation out of reset. signal is active during and immediately after a reset on nrst. see section 6.2: resets on page 48 for details. tracedata3 o synchronous cpu trace data bit 3. select 4-wire synchronous tr ace interface in arm core. enable trace interface in arm core. select alternate output f unction with gpioa_crh[7:4] 28 24 vdd_pads power pads supply (2.1-3.6 v) 29 pa6 i/o high current digital i/o tim1_ch3 o timer 1 channel 3 output enable timer output in tim1_ccer select alternate output f unction with gpioa_crh[11:8] i timer 1 channel 3 input (cannot be remapped.) table 2. pin descriptions (continued) 48-pin package pin no. 40-pin package pin no. signal direction description
pinout and pin description stm32w108hb stm32w108cc stm32w108cb stm32w108cz 26/285 docid16252 rev 15 30 25 pb1 i/o digital i/o sc1miso o spi slave data out of serial controller 1 either disable timer output in tim2_ccer or disable remap with tim2_or[4] select spi with sc1_cr select slave with sc1_spicr select alternate output f unction with gpiob_crl[7:4] sc1mosi o spi master data out of serial controller 1 either disable timer output in tim2_ccer or disable remap with tim2_or[4] select spi with sc1_cr select master with sc1_spicr select alternate output f unction with gpiob_crl[7:4] sc1sda i/o i 2 c data of serial controller 1 either disable timer ou tput in tim2_ccer, or disable rem ap with tim2_or[4] select i 2 c with sc1_cr select alternate open-dr ain output function with gpiob_crl[7:4] sc1txd o uart transmit data of serial controller 1 either disable timer output in tim2_ccer or disable remap with tim2_or[4] select uart with sc1_cr select alternate output f unction with gpiob_crl[7:4] tim2_ch1 (see also pin 21) o timer 2 channel 1 output enable remap wit h tim2_or[4] enable timer output in tim2_ccer select alternate output f unction with gpioa_crl[7:4] i timer 2 channel 1 input. dis able remap with tim2_or[4]. table 2. pin descriptions (continued) 48-pin package pin no. 40-pin package pin no. signal direction description
docid16252 rev 15 27/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz pinout and pin description 281 31 26 pb2 i/o digital i/o sc1miso i spi master data in of serial controller 1 select spi with sc1_cr select master with sc1_spicr sc1mosi i spi slave data in of serial controller 1 select spi with sc1_cr select slave with sc1_spicr sc1scl i/o i 2 c clock of serial controller 1 either disable timer output in tim2_ccer, or disable rem ap with tim2_or[5] select i 2 c with sc1_cr select alternate open-dr ain output function with gpiob_crl[11:8] sc1rxd i uart receive data of serial controller 1 select uart with sc1_cr tim2_ch2 (see also pin 25) o timer 2 channel 2 output enable remap wit h tim2_or[5] enable timer output in tim2_ccer select alternate output f unction with gpiob_crl[11:8] i timer 2 channel 2 input. en able remap with tim2_or[5]. 32 27 swclk i/o serial wire clock input/output with debugger selected when in serial wire mode (see jtms description, pin 35) jtck i jtag clock input from debugger selected when in jtag mode (default mode, see jtms description, pin 35) internal pull-down is enabled 33 28 pc2 i/o digital i/o enable with gpio_dbgcr[5] jtdo o jtag data out to debugger selected when in jtag mode (default mode, see jtms description, pin 35) swo o serial wire output asynchronous trace output to debugger select asynchronous trac e interface in arm core enable trace interface in arm core select alternate output func tion with gpioc_crl[11:8] enable serial wire mode (see jtms description, pin 35) internal pull-up is enabled table 2. pin descriptions (continued) 48-pin package pin no. 40-pin package pin no. signal direction description
pinout and pin description stm32w108hb stm32w108cc stm32w108cb stm32w108cz 28/285 docid16252 rev 15 34 29 pc3 i/o digital i/o either enable with gpio_dbgcr[5], or enable serial wire mode (see jtms description) jtdi i jtag data in from debugger selected when in jtag mode (default mode, see jtms description, pin 35) internal pull-up is enabled 35 30 pc4 i/o digital i/o enable with gpio_dbgcr[5] jtms i jtag mode select from debugger selected when in jtag mode (default mode) jtag mode is enabled after power-up or by forcing nrst low select serial wire mode using the arm-defined protocol through a debugger internal pull-up is enabled swdio i/o serial wire bidirectional data to/from debugger enable serial wire mode (see jtms description) select serial wire mode using the arm-defined protocol through a debugger internal pull-up is enabled 36 pb0 i/o digital i/o vref analog o adc reference output. enable analog function with gpiob_crl[3:0]. vref analog i adc reference input. enable analog function with gpiob_crl[3:0]. enable reference out put with an st system function. irqa i external interrupt source a. traceclk (see also pin 25) o synchronous cpu trace clock. enable trace interface in arm core. select alternate output function with gpiob_crl[3:0]. tim1clk i timer 1 external clock input. tim2msk i timer 2 external clock mask input. 37 vdd_pads power pads supply (2.1 to 3.6 v). table 2. pin descriptions (continued) 48-pin package pin no. 40-pin package pin no. signal direction description
docid16252 rev 15 29/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz pinout and pin description 281 38 31 pc1 i/o digital i/o adc3 analog adc input 3 enable analog function with gpioc_crl[7:4] swo (see also pin 33) o serial wire output asynchronous trace output to debugger select asynchronous trac e interface in arm core enable trace interface in arm core select alternate output f unction with gpioc_crl[7:4] tracedata0 o synchronous cpu trace data bit 0 select 1-, 2- or 4-wire synchronous trace interface in arm core enable trace interface in arm core select alternate output f unction with gpioc_crl[7:4] 39 32 vdd_mem power 1.8 v supply (flash, ram) 40 33 pc0 i/o high current digital i/o either enable with gpio_dbgcr[5], or enable serial wire mode (see jtms description, pin 35) and disable tracedata1 jrst i jtag reset input from debugger selected when in jtag mode (default mode, see jtms description) and tracedata1 is disabled internal pull-up is enabled irqd (1) i default external interrupt source d tracedata1 o synchronous cpu trace data bit 1 select 2- or 4-wire synchronous trace interface in arm core enable trace interface in arm core select alternate output f unction with gpioc_crl[3:0] 41 34 pb7 i/o high current digital i/o adc2 analog adc input 2 enable analog function with gpiob_crh[15:12] irqc (1) i default external interrupt source c tim1_ch2 o timer 1 channel 2 output enable timer output in tim1_ccer select alternate output func tion with gpiob_crh[15:12] i timer 1 channel 2 input (cannot be remapped) table 2. pin descriptions (continued) 48-pin package pin no. 40-pin package pin no. signal direction description
pinout and pin description stm32w108hb stm32w108cc stm32w108cb stm32w108cz 30/285 docid16252 rev 15 42 35 pb6 i/o high current digital i/o adc1 analog adc input 1 enable analog function with gpiob_crh[11:8] irqb i external interrupt source b tim1_ch1 o timer 1 channel 1 output enable timer output in tim1_ccer select alternate output f unction with gpiob_crh[11:8] i timer 1 channel 1 input (cannot be remapped) 43 pb5 i/o digital i/o adc0 analog adc input 0 enable analog function with gpiob_crh[7:4] tim2clk i timer 2 external clock input tim1msk i timer 2 external clock mask input 44 36 vdd_core power 1.25 v digital core supply decoupling 45 37 vdd_pre power 1.8 v prescaler supply 46 vdd_synth power 1.8 v synthesizer supply 47 38 osc_in i/o 24 mhz hse osc or left open when using external clock input on osc_out 48 39 osc_out i/o 24 mhz hse osc or external clock input 49 41 gnd ground ground supply pad in the bottom center of the package. 1. irqc and irqd external interrupts can be mapped to any digital i/o pin using the extic_cr and extid_cr registers. table 2. pin descriptions (continued) 48-pin package pin no. 40-pin package pin no. signal direction description
docid16252 rev 15 31/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz embedded memory 281 4 embedded memory 4.1 memory organization and memory map the bytes are coded in the memory in little endian format. the lowest numbered byte in a word is considered the word?s least significan t byte and the highest numbered byte the most significant. for detailed mapping of peripheral registers, please refer to the relevant section. all the memory areas that are not allocated to on-chip memories and peripherals are considered ?reserved?). refer to figure 4: stm32w108xb memory mapping, figure 5: stm32w108cc and stm32w108cz memory mapping, and table 3: stm32w108xx peripheral register boundary addresses for the register boundary addresses of the peripherals available in all stm32w108xx devices.
embedded memory stm32w108hb stm32w108cc stm32w108cb stm32w108cz 32/285 docid16252 rev 15 figure 4. stm32w108xb memory mapping main flash block (128kb) lower mapping (normal mode) 0 7 0x00000000 0x0001ffff ram (8kb) mapped onto system interface 0x20000000 0x20001fff ram bit band alias region mapped onto system interface (not used) 0x22000000 0x22002000 flash ram peripheral registers mapped onto system interface register bit band alias region mapped onto system interface (not used) 0x40000000 0x40000xxx 0x42000000 0x42002xxx not used private periph bus (internal) not used private periph bus (external) not used not used not used 0xe0000000 itm dwt fpb nvic tpiu rom table 0xe0001000 0xe0002000 0xe0003000 0xe000e000 0xe000f000 0xe003ffff 0xe0040000 0xe0041000 0xe0042000 0xe00ff000 0xe00fffff 0xe0000000 0x00000000 0x20000000 0x40000000 0x60000000 0xa0000000 0xffffffff 0xdfffffff 0x9fffffff 0x5fffffff 0x3fffffff 0x1fffffff fixed info block (2kb) customer info block (0.5kb) 0x08040000 0x080407ff 0x080409ff 0x08040800 main flash block (128kb) upper mapping (boot mode) 0x08000000 0x0801ffff fixed info block (2kb) optional boot mode maps fixed info block to the start of memory 0x000007ff not used not used ai15259
docid16252 rev 15 33/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz embedded memory 281 figure 5. stm32w108cc and stm32w108cz memory mapping ms19580v1 main flash block (192/256kb) lower mapping (normal mode) 0 7 0x00000000 0x0002ffff /0x0003ffff ram (12/16kb) mapped onto system interface 0x20000000 0x20002fff /0x20003fff ram bit band alias region mapped onto system interface (not used) 0x22000000 0x22002000 flash ram peripheral registers mapped onto system interface register bit band alias region mapped onto system interface (not used) 0x40000000 0x40000xxx 0x42000000 0x42002xxx not used private periph bus (internal) not used private periph bus (external) not used not used not used 0xe0000000 itm dwt fpb nvic tpiu rom table 0xe0001000 0xe0002000 0xe0003000 0xe000e000 0xe000f000 0xe003ffff 0xe0040000 0xe0041000 0xe0042000 0xe00ff000 0xe00fffff 0xe0000000 0x00000000 0x20000000 0x40000000 0x60000000 0xa0000000 0xffffffff 0xdfffffff 0x9fffffff 0x5fffffff 0x3fffffff 0x1fffffff fixed info block (2kb) customer info block (2kb) 0x08040000 0x080407ff 0x08040fff 0x08040800 main flash block (192/256 kb) upper mapping (boot mode) 0x08000000 0x0802ffff /0x0803ffff fixed info block (2kb) optional boot mode maps fixed info block to the start of memory 0x000007ff not used not used fixed info block extension (16kb) 0x08041000 0x08044fff
embedded memory stm32w108hb stm32w108cc stm32w108cb stm32w108cz 34/285 docid16252 rev 15 table 3. stm32w108xx peripheral register boundary addresses bus boundary address peripheral register map apb 0x4000 f000 - 0x4000 ffff general-purpose timer 2 (tim2) table 10.3.20: general- purpose timers 1 and 2 (tim1/tim2) register map 0x4000 e000 - 0x4000 efff general-purpose timer 1 (tim1) table 10.3.20: general- purpose timers 1 and 2 (tim1/tim2) register map 0x4000 d025 - 0x4000 dfff reserved - 0x4000 d000 - 0x4000 d024 analog-to-digital converter (adc) table 11.3.12: analog- to-digital converter (adc) register map 0x4000 c871 - 0x4000 cfff reserved - 0x4000 c800 - 0x4000 c870 serial interface (sc1) table 9.12.17: serial interface (sc1/sc2) register map 0x4000 c071 - 0x4000 c7ff reserved - 0x4000 c000 - 0x4000 c070 serial interface (sc2) table 9.12.17: serial interface (sc1/sc2) register map 0x4000 b000 - 0x4000 bfff general-purpose input/output (gpio) table 8.5.13: general- purpose input/output (gpio) register map 0x4000 a000 - 0x4000 afff management interrupt (mgmt) table 12.2.3: management interrupt (mgmt) register map 0x4000 6025 - 0x4000 9fff reserved - 0x4000 600c - 0x4000 6024 sleeptimer (slptmr) mac timer (mactmr)/watchdog (wdg)/sleeptimer(slp tmr) register map 0x4000 6009 - 0x4000 600b reserved - 0x4000 6000 - 0x4000 6008 watchdog (wdg) mac timer (mactmr)/watchdog (wdg)/sleeptimer(slp tmr) register map 0x4000 5000 - 0x4000 5fff memory controller (mem) memory controller (mem) register map 0x4000 4021 - 0x4000 4fff reserved - 0x4000 4000 - 0x4000 4020 clock switching (clk) clock switching (clk) register map 0x4000 3000 - 0x4000 3fff reserved -
docid16252 rev 15 35/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz embedded memory 281 4.2 flash memory the stm32w108 provides flash memory in four separate blocks as follows: ? main flash block (mfb) ? fixed information block (fib) ? fixed information bloc k extension (fib-ext) ? customer information block (cib) the size of these blocks and associated page size is described in table 4 . the smallest erasable unit is one page and the smallest writable unit is an aligned 16-bit half-word. the flash is guaranteed to have 10k write/erase cycles. the flash cell has been qualified for a data retention time of >100 years at room temperature. apb 0x4000 2000 - 0x4000 2fff mac timer (mactmr) mac timer (mactmr)/watchdog (wdg)/sleeptimer(slp tmr) register map 0x4000 1000 - 0x4000 1fff reserved - 0x4000 0000 - 0x4000 0fff power management (pwr) power management (pwr) register map 0x2000 4000 - 0x3fff ffff reserved - 0x2000 0000 - 0x2000 3fff sram - 0x0804 0000 - 0x1fff ffff reserved - 0x0800 0000 - 0x0803 ffff main flash memory (256 kbyte) - table 3. stm32w108xx peripheral register boundary addresses (continued) bus boundary address peripheral register map table 4. flash memory stm32w108xb stm32w108cc stm32w108cz unit size page size size page size size page size mfb 128 1 256 2 192 2 kbytes fib 222222kbytes cib 0.50.52222kbytes fib-ext 0n/a162162kbytes total 130.5 276 212 kbytes
embedded memory stm32w108hb stm32w108cc stm32w108cb stm32w108cz 36/285 docid16252 rev 15 flash may be programmed either through the serial wire/jtag interface or through bootloader software. programming flash throug h serial wire/jtag requires the assistance of ram-based utility code. progra mming through a bootloader requ ires specific software for over-the-air loading or serial link loading. a si mplified, serial-link-only bootloader is also available preprogrammed into the fib. 4.3 random-access memory the stm32w108 has 8/12/16 kbytes of static ram on-chip. the start of ram is mapped to address 0x20000000. although the arm? cortex-m3 allows bit band accesses to this address region, the standard mpu configuratio n does not permit use of the bit-band feature. the ram is physically connected to the ahb system bus and is therefore accessible to both the arm? cortex-m3 microprocessor and the debugger. the ram can be accessed for both instruction and data fetches as bytes, half words, or words. the standard mpu configuration does not permit execution from the ram, but for special purposes, such as programming the main flash block, the mp u may be disabled. to the bus, the ram appears as 32-bit wide memory and in most si tuations has zero wait state read or write access. in the higher cpu clock mode the ram r equires two wait states. this is handled by hardware transparent to the user app lication with no configuration required. 4.3.1 direct memory access (dma) to ram several of the peripherals are equipped with dma controllers allowing them to transfer data into and out of ram autonomously. this applies to the radio (802.15.4 mac), general purpose adc, and both serial c ontrollers. in the case of the serial controllers, the dma is full duplex so that a read and a write to ram ma y be requested at the same time. thus there are six dma channels in total. the stm32w108 integrates a dma arbiter that ensures fair access to the microprocessor as well as the peripherals through a fixed priority scheme appropriate to the memory bandwidth requirements of each master. the priority scheme is as follows, with the top peripheral being the highest priority: 1. general purpose adc 2. serial controller 2 receive 3. serial controller 2 transmit 4. mac 5. serial controller 1 receive 6. serial controller 1 transmit
docid16252 rev 15 37/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz embedded memory 281 4.3.2 ram memory protection the stm32w108 integrates two memory pr otection mechanisms. the first memory protection mechanism is through the arm? cortex-m3 memory protection unit (mpu) described in the memory protection unit secti on. the mpu may be used to protect any area of memory. mpu configuration is normally handled by software. the second memory protection mechanism is through a fine granul arity ram protection module. this allows segmentation of the ram into blocks where any block can be marked as write protected. an attempt to write to a protected ram block using a user mode write results in a bus error being signaled on the ahb system bus. a sys tem mode write is allowed at any time and reads are allowed in either mode. the main purpose of this fine granularity ram protection module is to notify the stack of erroneous writes to system ar eas of memory. ram protection is configured using a group of registers th at provide a bit map. each bit in the map represents a 32-byte block of ram for stm32w108xb and 64 bytes of ram for stm32w108cc and stm32w108cz.when the bit is set the block is write protected. the fine granularity ram memory protection mechanism is also available to the peripheral dma controllers. a register bit is provided to enable the memory protection to include dma writes to protected memory. if a dma write is made to a protected location in ram, a management interrupt is generated. at the same time the faulting address and the identification of the pe ripheral is captured for later debugging. note that only peripherals capable of writing data to ram, such as rece ived packet data or a received serial port character, can generate this interrupt. 4.3.3 memory controller the stm32w108xx allows the ram and dma protection to be controlled using the memory controller interface. the chip contains ei ght ram protection registers and two dma protection registers. in addition, the chip contains a register, ram_cr, for enabling the protection of the memory.
embedded memory stm32w108hb stm32w108cc stm32w108cb stm32w108cz 38/285 docid16252 rev 15 4.3.4 memory controller registers ram is divided into 32 byte pages. each page ha s a register bit that, when set, protects it from being written in user mode. the protection registers (mem_prot) are arranged in the register map as a 256-bit vector. bit 0 of this ve ctor protects page 0 which begins at location 0x2000 0000 and ends at 0x2000 001f. bit 255 of this vector protects the top page which starts at 0x20001fe0 and ends at 0x2000 1fff. memory ram protection register x (ram_protrx) address: 0x 4000 5000 (ram_pro tr1), 0x 4000 5004 (ram_protr2), 0x 4000 5008 (ram_protr3), 0x 4000 500c (ram_protr4), 0x 4000 5010 (ram_protr5), 0x 4000 5014 (ram_protr6), 0x 4000 5018(ram_protr7), and 0x 4000 501c (ram_protr8). reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 memory page protection x[31:16 rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw 1514131211109876543210 memory page protection x[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:0 memory page protection x[31:0]: bit 0 in the ram_protr1 protects page 0 ? bit 31 in the ram_protr1 protects page 31 bit 0 in the ram_protr2 protects page 32 ? bit 31 in the ram_protr2 protects page 63 bit 0 in the ram_protr3 protects page 64 ? bit 31 in the ram_protr3 protects page 95 bit 0 in the ram_protr4 protects page 96 ? bit 31 in the ram_protr4 protects page 127 bit 0 in the ram_protr5 protects page 128 ? bit 31 in the ram_protr5 protects page 159 bit 0 in the ram_protr6 protects page 160 ? bit 31 in the ram_protr6 protects page 191 bit 0 in the ram_protr7 protects page 192 ? bit 31 in the ram_protr7 protects page 223 bit 0 in the ram_protr8 protects page 224 ?. bit 31 in the ram_protr8 protects page 255
docid16252 rev 15 39/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz embedded memory 281 memory dma protection register 1 (dma_protr1) address: 0x 4000 5020 reset value: 0x2000 0000 memory dma protection register 2 (dma_protr2) address: 0x 4000 5024 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 offset[18:3] r r r r r r r r r r r r r r r r 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 offset[2:0] address[11:0] reserved r r r r r r r r r r r r r r r bits 31:13 offset[18:0]: offset in ram bits 12:1 offset[11:0]: dma protection fault, faulting address. bit 0 reserved, must be kept at reset value 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved channel[2:0] r r r bits 31:3 reserved, must be kept at reset value bits 2:0 channel[2:0]: channel encoding 7: not used 6: not used 5: sc2_rx 4: not used 3: adc 2: not used 1: sc1_rx 0: not used
embedded memory stm32w108hb stm32w108cc stm32w108cb stm32w108cz 40/285 docid16252 rev 15 memory ram control register (ram_cr) address: 0x 4000 5028 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved wen reserved rw bits 31:3 reserved, must be kept at reset value bit 2 wen: makes all ram writes appear as user mode bits 1:0 reserved, must be kept at reset value
docid16252 rev 15 41/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz embedded memory 281 memory controller (mem) register map table 5 gives the mem register map and reset values. refer to figure 4: stm32w108xb memory mapping, figure 5: stm32w108cc and stm32w108cz memory mapping, and table 3: stm32w108xx peripheral register boundary addresses for the register boundary addresses of the peripherals available in all stm32w108xx devices. table 5. mem register map and reset values offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0x5000 ram_protr1 memory page protection 1[31:0] reset value 00000000000000000000000000000000 0x5004 ram_protr2 memory page protection 2[31:0] reset value 00000000000000000000000000000000 0x5008 ram_protr3 memory page protection 3[31:0] reset value 00000000000000000000000000000000 0x500c ram_protr4 memory protection 4[31:0] reset value 00000000000000000000000000000000 0x5010 ram_protr5 memory protection 5[31:0] reset value 00000000000000000000000000000000 0x5014 ram_protr6 memory protection 6[31:0] reset value 00000000000000000000000000000000 0x5018 ram_protr7 memory protection 7[31:0] reset value 00000000000000000000000000000000 0x501c ram_protr8 memory protection 8[31:0] reset value 00000000000000000000000000000000 0x5020 dma_protr1 offset[18:0] address[11:0] re s . reset value 0010000000000000000000000000000 0x5024 dma_protr2 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . channel[2:0] reset value 0000 0x5028 ram_cr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . wen re s . re s . reset value 0
embedded memory stm32w108hb stm32w108cc stm32w108cb stm32w108cz 42/285 docid16252 rev 15 4.4 memory protection unit the stm32w108 includes the arm? cortex-m3 memory protection unit, or mpu. the mpu controls access rights and characteristics of up to eight address regions, each of which may be divided into eight equal sub-regi ons. refer to the arm? cortex-m3 technical reference manual (ddi 0337a) for a detailed description of the mpu. st software configures the mpu in a standard configuration and application software should not modify it. the configuration is designed for optimal detection of illegal instruction or data accesses. if an illegal access is attempted, the mpu captures information about the access type, the address being accessed, and the locati on of the offending software. this simplifies software debugging and increase s the reliability of deployed devices. as a consequence of this mpu configuration, accessing ram and register bit-band address alias regions is not permitted, and generates a bus fault if attempted.
docid16252 rev 15 43/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz radio frequency module 281 5 radio frequency module the radio module consists of an analog front end and digital baseband as shown in figure 1: stm32w108 block diagram . 5.1 receive (rx) path the rx path uses a low-if, super-heterodyne receiver that rejects the image frequency using complex mixing and polyphase filtering. in the analog domain, the input rf signal from the antenna is first amplified and mixed down to a 4 mhz if frequency. the mixers' output is filtered, combined, and amplified before being sampled by a 12 msps adc. the digitized signal is then demodulated in the digi tal baseband. the filtering within the rx path improves the stm32w108's co-e xistence with othe r 2.4 ghz transceivers such as ieee 802.15.4, ieee 802.11g, and bl uetooth radios. the digital baseband also provides gain control of the rx path, both to enable the re ception of small and large wanted signals and to tolerate large interferers. 5.1.1 rx baseband the stm32w108 rx digital baseband implements a coherent demodulator for optimal performance. the baseband demodulates th e o-qpsk signal at the chip level and synchronizes with the ieee 802.1 5.4-defined pr eamble. an automati c gain control (agc) module adjusts the analog gain continuously ev ery ? symbol until the preamble is detected. once detected, the gain is fixed for the remainder of the packet. the baseband despreads the demodulated data into 4-bit symbols. t hese symbols are buffered and passed to the hardware-based mac module for packet assembly and filtering. in addition, the rx baseband provides the calib ration and control interface to the analog rx modules, including the lna, rx baseband filter, and modulation modules. the st rf software driver includes calibration algorithms that use this interface to reduce the effects of silicon process and temperature variation. 5.1.2 rssi and cca the stm32w108 calculates the rssi over every 8-symbol period as well as at the end of a received packet. the linear range of rssi is specif ied to be at least 40 db over temperature. at room temperature, the linear range is approximately 60 db (-90 dbm to -30 dbm input signal). the stm32w108 rx bas eband provides supp ort for the ieee 802.1 5.4-2003 rssi cca method, clear channel reports busy medium if rssi exceeds its threshold.
radio frequency module stm32w108hb stm32w108cc stm32w108cb stm32w108cz 44/285 docid16252 rev 15 5.2 transmit (tx) path the stm32w108 tx path prod uces an o-qpsk-modulated sig nal using the analog front end and digital baseband. the area- and power- efficient tx architecture uses a two-point modulation scheme to modulate the rf signal generated by the synthesizer. the modulated rf signal is fed to the integrated pa and then out of the stm32w108. 5.2.1 tx baseband the stm32w108 tx baseba nd in the digital domain spread s the 4-bit symbol into its ieee 802.15.4-2003-defined 32-chip sequence. it also provides the interface for software to calibrate the tx module to re duce silicon process, temperat ure, and voltage variations. 5.2.2 tx_active and ntx_active signals for applications requiring an external pa, two signals are provided called tx_active and ntx_active. these signals are the inverse of each other. they can be used for external pa power management and rf switching logic. in transmit mode the tx baseband drives tx_active high, as described in table 17: gpio signal assignments on page 98 . in receive mode the tx_active signal is low. tx _active is the alternate function of pc5, and ntx_active is the altern ate function of pc6. see section 8: general-purpose input/output on page 91 for details of the alternate gpio functions. 5.3 calibration the st rf software driver calibrates the radio using dedicated hardware resources. 5.4 integrated mac module the stm32w108 int egrates most of the ieee 802.15.4 mac requirements in hardware. this allows the arm? cortex-m3 cpu to pr ovide greater bandwidth to application and network operations. in addition, the hardware ac ts as a first-line filter for unwanted packets. the stm32w108 mac uses a dma interface to ram to further reduce the overall arm? cortex-m3 cpu interaction when tr ansmitting or receiving packets. when a packet is ready for transmission, the software configures the tx mac dma by indicating the packet buffer ram location. the mac waits for the backoff period, then switches the baseband to tx mode and performs channel assessment. when the channel is clear the mac reads data from the ram buffer , calculates the crc, and provides 4-bit symbols to the baseband. when the final byte ha s been read and sent to the baseband, the crc remainder is read and transmitted. the mac is in rx mode most of the time. in rx mode various format and address filters keep unwanted packets from using excessive ram buffers, and prevent the cpu from being unnecessarily interrupted. when the reception of a packet begins, the mac reads 4- bit symbols from the baseband and calculates th e crc. it then assemb les the received data for storage in a ram buffer. rx mac dma provides direct access to ram. once the packet has been received additional data, which provides statistical information on the packet to the software stack, is appended to the end of the packet in the ram buffer space.
docid16252 rev 15 45/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz radio frequency module 281 the primary features of the mac are: ? crc generation, appending, and checking ? hardware timers and interrupts to achieve the mac symbol timing ? automatic preamble and sfd pre-pending on tx packets ? address recognition and packet filtering on rx packets ? automatic acknowledge ment transmission ? automatic transmission of packets from memory ? automatic transmission after backoff time if channel is clear (cca) ? automatic acknowledgement checking ? time stamping received and transmitted messages ? attaching packet info rmation to received packets (lqi, rssi, gain, time stamp, and packet status) ? ieee 802.15.4 timing and slotted/unslotted timing 5.5 packet trace interface (pti) the stm32w108 integrates a true phy-level pti for effective network-level debugging. it monitors all the phy tx and rx packets bet ween the mac and baseband modules without affecting their normal operation. it cannot be used to inject packets into the phy/mac interface. this 500 kbps asynchronous interf ace comprises the frame signal (pti_en, pa4) and the data signal (pti_data, pa5). 5.6 random number generator thermal noise in the analog circuitry is digitized to provide entropy for a true random number generator (trng). the trng produces 16-bit uniformly distributed numbers. the software can use the trng to seed a pseudo random number generator (pnrg). the trng is also used directly fo r cryptographic key generation.
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 46/285 docid16252 rev 15 6 system modules system modules encompass po wer, resets, clocks, system timers, power management, and encryption. figure 6 shows these modules and how they interact. figure 6. system module block diagram nreset vdd_pads vreg_ out vdd_core vdd_mem por hv por lvcore por lvmem vreg _1 v8 vreg _1 v25 always-on supply mem supply core supply por lv por hv reset filter re s et gen er at io n external regulator optional connections for external regulator lsi10k lse osc div10 lsi1k lse osc32_out osc32_in jrst always- on domain pores et sys rese t dapreset mem domain cortex -m3 debug ahb -ap sysresetreq core domain cortex-m3 cpu flitf option byte error flash ram hse osc hsi osc_out osc_in clock switch sclk cdbgrstreq power management w atchdog sleep timer watchdog deep sleep wakeup reg_en recomended connections for internal regulator preset hv preset lv registers registers security accelerator swj reset recording w akeup recording gpio wake monitoring pa2 pb2 irqd sleep timer compare b wa ke_ co re cd b gpw ru p re q cs ysp wr u pr eq sleep timer compare a sleep timer wrap
docid16252 rev 15 47/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 6.1 power domains the stm32w108 contains three power domains: ? an "always on domain" containing all logic and analog cells required to manage the stm32w108's power modes, including the gpio controller and sleep timer. this domain must remain powered. ? a "core domain" containing the cpu, nested vectored interrupt controller (nvic), and peripherals. to save power, this domain can be powered down using a mode called deep sleep. ? a "memory domain" containing the ram and flash memories. this domain is managed by the power management controller. when in deep sleep, the ram portion of this domain is powered from the always-on domain supply to retain the ram contents while the regulators are disabled. during deep sleep the flash portion is completely powered down. 6.1.1 internally regulated power the preferred and recommended power configuratio n is to use the internal regulated power supplies to provide power to the core and memory domains. the internal regulators (vreg_1v25 and vreg_1v8) ge nerate nominal 1.25 v and 1.8 v supplies. the 1.25 v supply is internally routed to the core domain and to an external pin. the 1.8 v supply is routed to an external pin where it can be extern ally routed back into the chip to supply the memory domain. the internal regulators are described in section 7: integrated voltage regulator on page 89 . when using the internal regulators, the always-on domain must be powered between 2.1 v and 3.6 v at all four vdd_pads pins. when using the internal regulators, the vreg _1v8 regulator output pin (vreg_out) must be connected to the vdd_mem, vdd_pads a, vdd_vco, vdd_rf, vdd_if, vdd_pre, and vdd_synth pins. when using the internal regulators, the vreg_1v25 regulator output and supply requires a connection between both vdd_core pins. 6.1.2 externally regulated power optionally, the on-chip regulators may be left unused, and the core and memory domains may instead be powered from external supplie s. for simplicity, the voltage for the core domain can be raised to nominal 1.8 v, requiring only one external regulator. note that if the core domain is powered at a higher voltage (1.8 v instead of 1.25 v) then power consumption increases. a regulator enable si gnal, reg_en, is provided for control of external regulators. this is an open-drain signal that requires an external pull-up resistor. if reg_en is not required to control external regulators it can be disabled (see section 8.1.3: forced functions on page 94 ). using an external regulator requires the al ways-on domain to be powered between 1.8 v and 3.6 v at all four vdd_pads pins. when using an external regulator, the vreg _1v8 regulator output pin (vreg_out) must be left unconnected. when using an external regulator, this external nominal 1.8 v supply has to be connected to both vdd_core pins and to the vdd_mem, vdd_padsa, vdd_vco, vdd_rf, vdd_if, vdd_pre and vdd_synth pins.
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 48/285 docid16252 rev 15 6.2 resets the stm32w108 resets are generated from a number of sources. each of these reset sources feeds into central reset detection logi c that causes various parts of the system to be reset depending on the state of the syst em and the nature of the reset event. 6.2.1 reset sources for power-on reset (por hv and por lv) thresholds, see section 14.3.2: operating conditions at power-up on page 248 . watchdog reset the stm32w108 contains a watchdog timer (see also the watchdog timer section) that is clocked by the internal 1 khz timing reference. when the timer expires it generates the reset source watchdog_reset to the reset generation module. software reset the arm? cortex-m3 cpu can initiate a reset unde r software control. th is is indicated with the reset source sysresetreq to the reset generation module. note: when using certain external debuggers, the chip may lock up require a pin reset or power cycle if the debugger assert s sysresetreq. it is recommend ed not to write to the scs_aircr register di rectly from application code. the st software provides a reset function that should be used instead. this rese t function ensures that the chip is in a safe clock mode prior to triggering the reset. option byte error the flash memory controller contains a state machine that reads configuration information from the information blocks in the flash at sys tem start time. an error check is performed on the option bytes that are read from flash and, if the check fails, an error is signaled that provides the reset source opt_byte_e rror to the reset generation module. if an option byte error is de tected, the system restarts and the read and check process is repeated. if the error is detected again the process is repeated but stops on the 3rd failure. the system is then placed into an emulated deep sleep where recovery is possible. in this state, flash memory readout protection is forced active to prevent secure applications from being compromised. debug reset the serial wire/jtag interface (swj) provides access to the swj debug port (swj-dp) registers. by setting the register bit cdb grstreq in the swj-dp, the reset source cdbgrstreq is provided to the reset generation module. jtag reset one of the stm32w108's pins can function as the jtag reset, conforming to the requirements of the jtag standard. this input acts independently of all other reset sources and, when asserted, does not reset any on-chi p hardware except for the jtag tap. if the stm32w108 is in the serial wire mode or if the swj is disabled, this input has no effect.
docid16252 rev 15 49/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 deep sleep reset the power management module informs the reset generation module of entry into and exit from the deep sleep states. the deep sleep reset is applied in the following states: before entry into deep sleep, while removing power from the memory and core domain, while in deep sleep, while waking from deep sleep, a nd while reapplying power until reliable power levels have been detect by por lv. the power management module allows a specia l emulated deep sleep state that retains memory and core domain power while in deep sleep. 6.2.2 reset recording the stm32w108 records the last reset conditio n that generated a restart to the system. the reset conditions recorded are: ? pwrhv always-on domain power supply failure ? pwrlv core or memory domain power supply failure ? rstb nrst pin asserted ? wdg watchdog timer expired ? swrst software reset by syserset req from arm? cortex-m3 cpu ? wkup wake-up from deep sleep ? obfail error check failed when reading option bytes from flash memory the reset status register (rst_sr) is used to read back the last reset event. all bits are mutually exclusive except the obfail bit whic h preserves the original reset event when set. note: while cpu lockup is marked as a reset condition in software, cpu lockup is not specifically a reset event. cpu lockup is set to indicate that the cpu entered an unrecoverable exception. execut ion stops but a reset is not applied. this is so that a debugger can interpret the cause of the error. we recommend that in a live application (i.e. no debugger attached) the watchdog be enabled by default so that the stm32w108 can be restarted.
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 50/285 docid16252 rev 15 6.2.3 reset generation the reset generation module responds to reset sources and generates the following reset signals: ? poreset reset of the arm? cort ex-m3 cpu and ar m? cortex-m3 system debug components (flash patch and breakpoint, data watchpoint and trace, in strumentation trace macrocell, nested vectored interrupt controller). arm defines poreset as the region that is reset when power is applied. ? sysreset reset of the arm? cortex -m3 cpu without resetting the core debug and system debug components, so that a live system can be reset without disturbing the debug configuration. ? dapreset reset to the swj's ahb access port (ahb-ap). ? presethv peripheral reset for always-on power domain, for peripherals that are required to retain their configuration across a deep sleep cycle. ? presetlv peripheral reset for core power domain, for peripherals that are not required to retain their configuration across a deep sleep cycle. table 6 shows which reset sources generate certain resets. table 6. generated resets reset source reset generation poreset sysreset dapreset presethv presetlv por hv xxxxx por lv (in deep sleep) x x x x por lv (not in deep sleep) xxxxx rstb xx xx watchdog reset x x x software reset x x x option byte error x x x normal deep sleep x x x x emulated deep sleep x x debug reset x
docid16252 rev 15 51/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 6.2.4 reset register reset status register (rst_sr) address offset: 0x4000 002c reset value: 0x0000 0001 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved lkup obfail wkup swrst wdg pin pwrlv pwrhv rr r rrrr r bits 31:8 reserved, must be kept at reset value bit 7 lkup: when set to ?1?, the reset is due to core lockup. bit 6 obfail: when set to ?1?, the reset is due to an opti on byte load failure (may be set with other bits). bit 5 wkup: when set to ?1?, the reset is due to a wake-up from deep sleep. bit 4 swrst: when set to ?1?, the reset is due to a software reset. bit 3 wdg: when set to ?1?, the reset is due to watchdog expiration. bit 2 pin: when set to ?1?, the reset is due to an external reset pin signal. bit 1 pwrlv: when set to ?1?, the reset is due to the applic ation of a core power supply (or previously failed). bit 0 pwrhv: always set to ?1?, normal power applied.
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 52/285 docid16252 rev 15 reset (rst) register map table 7 gives the rst register map and reset values. refer to figure 4: stm32w108xb memory mapping, figure 5: stm32w108cc and stm32w108cz memory mapping, and table 3: stm32w108xx peripheral register boundary addresses for the register boundary addresses of the peripherals available in all stm32w108xx devices. table 7. rst register map and reset values offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0x002c rst_sr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . lkup obfail wkup swrst wdg pin pwrlv pwrhv reset value 00000000
docid16252 rev 15 53/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 6.3 clocks the stm32w108 in tegrates four oscillators: ? high frequency rc oscillator (hsi) ? 24 mhz crystal oscillator (hse) ? 10 khz lsi rc oscillator (lsi10k) ? 32.768 khz crystal oscillator (lse) note: the lsi1k clock is generated from the 10 khz lsi rc oscilla tor (lsi10k). the default value is a divide by 10 for a nominal 1 khz output clock. figure 7 shows a block diagram of the clocks in the stm32w108. th is simplified view shows all the clock sources and the general areas of the chip to which they are routed. figure 7. clocks block diagram pclk lse osc bu s produces 6 mhz or 1mhz sclk lsi10k lsi1k oscillator failover monitor (selects rc when xtal fails ) hsi hse osc fclk cpu bus ram ctrl ram bu s bus flitf flash clk_hsecr2_sw1 systick_ctrl_clksource slptmr _ cr_clksel coredebug_demcr_trcena tim_smcr_sms[2:0] tim2_or_extrigsel[1:0] timxclk digital in 12 mhz hsi rc 24 mhz hse osc 10 khz lsi rc 32 khz digital in /2 /2 /(2^n) oscillator clk_sleepcr_lseen 32 khz lse osc mac timer counter scx rategen systick counter timx counter adc sigmadelta sleep timer counter w atchdog counter and traceclk digital out scxsclk digital i /o /n (nominal 10 ) slptmr_cr_psc[7:4] adc_cr_clk clk_hsecr2_en clk_cr2_sw2
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 54/285 docid16252 rev 15 6.3.1 high-frequency intern al rc oscillator (hsi) the high-frequency rc oscillato r (hsi) is used as the defaul t system clock source when power is applied to the core domain. the nominal frequency coming out of reset is 12 mhz. most peripherals, excluding the radio peripher al, are fully functional using the hsi clock source. application software must be aware that peripherals are clocked at different speeds depending on whether hsi or hse osc is being used. since the frequency step of hsi is 0.5 mhz and the high-frequency crystal oscilla tor is used for calibration, the calibrated accuracy of hsi is 250 khz 40 ppm. the uart and adc peripherals may not be usable due to the lower accuracy of the hsi frequency. see also section 14.6.1: high frequency inter nal clock characteristics on page 258 . 6.3.2 high-frequency crysta l oscillator (hse osc) the high-frequency crystal oscillator (hse osc) requires an extern al 24 mhz crystal with an accuracy of 40 ppm. based upon the ap plication's bill of ma terials and current consumption requirements, the external crystal may cover a range of esr requirements. the crystal oscillator has a software-progr ammable bias circuit to minimize current consumption. st software configures the bi as circuit for minimum current consumption. all peripherals including the radio peripheral are fully functional using the hse osc clock source. application software must be aware that peripherals are clocked at different speeds depending on whether hsi or hse osc is being used. if the 24 mhz crystal fails, a ha rdware failover mechanism forc es the system to switch back to the high-frequency rc oscilla tor as the main clock source, and a non-maskable interrupt (nmi) is signaled to the arm? cortex-m3 nvic. see also section 14.6.2: high frequency external clock characteristics on page 258 . 6.3.3 low-frequency internal rc oscillator (lsi10k) a low-frequency rc oscillator (l si10k) is provided as an in ternal timing reference. the nominal frequency coming out of reset is 10 kh z, and st software ca librates this clock to 10 khz. from the tuned 10 khz oscillator (lsi 10k) st software calibrates a fractional-n divider to produce a 1 khz reference clock, lsi1k. see also section 14.6.3: low frequency inter nal clock characteristics on page 259 . 6.3.4 low-frequency crystal oscillator (lse osc) a low-frequency 32.768 khz crystal oscillator (lse osc) is provided as an optional timing reference for on-ch ip timers. this oscillator is desi gned for use with an external watch crystal. see also section 14.6.4: low frequency external clock characteristics on page 259 .
docid16252 rev 15 55/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 6.3.5 clock switching the stm32w108 has two switching mechanisms fo r the main system clock, providing four clock modes. the register bit sw1 in the clk_hsecr2 regi ster switches between the high-frequency rc oscillator (hsi) and the high-f requency crystal oscillator (h se osc) as the main system clock (sclk). the peripheral clock (pclk) is always half the frequency of sclk. the register bit sw2 in the clk_cpucr regi ster switches between pclk and sclk to produce the arm? cortex-m3 cpu clock (fclk). the default and preferred mode of operation is to run the cpu at the lower pclk frequency, 12 mhz, but the higher sclk frequency, 24 mhz, can be sele cted to give higher processing performance at the expense of an increase in power consumption. in addition to these modes, further automati c control is invoked by hardware when flash programming is enabled. to ensure accuracy of the flash controller's timers, the fclk frequency is forced to 12 mhz during flash programming and erase operations. table 8. system clock modes sw1 clk_cpucr sclk pclk f clk flash program/ erase inactive flash program/ erase active 0 (hsi) 0 (normal cpu) 12 mhz 6 mhz 6 mhz 12 mhz 0 (hsi) 1 (fast cpu) 12 mhz 6 mhz 12 mhz 12 mhz 1 (hse osc) 0 (normal cpu) 24 mhz 12 mhz 12 mhz 12 mhz 1 (hse osc) 1 (fast cpu) 24 mhz 12 mhz 24 mhz 12 mhz
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 56/285 docid16252 rev 15 6.3.6 clock switching registers clock sleep mode control register ( clk_ sleepcr) the sleep timer controls the low power clock gated modes. clearing the lsi10ken bit in the clk_sleep cr register before executing wfi with the sleepdeep bit set to '1' in the scb_scr register (for more de tails refer to the cortex-m3 programming manual pm0056) causes deep sleep 2 mode to be entered. setting the lsi10ken bit in the clk_sleepcr register causes deep sleep 1 mode to be entered. address: 0x4000 0008 reset value: 0x0000 0002 low-speed internal 10 khz clock (lsi10k) control register (clk_lsi10kcr) address: 0x4000 000c reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved lsi10ken lseen rw rw bits 31:2 reserved, must be kept at reset value bit 1 lsi10ken: 1: enables 10 khz internal rc during deep sleep mode. 2: disables 10 khz internal rc during deep sleep mode bit 0 lseen: 1: enables 32 khz external oscillator during deep sleep mode. 2: disables 32 khz external oscillator during deep sleep mode. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved tune[3:0] rw rw rw rw bits 1:4 reserved, must be kept at reset value bits 3:0 tune[3:0]: tunes the value for the hsi clock.
docid16252 rev 15 57/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 low-speed internal 1 khz clock control register (clk_lsi1kcr) address: 0x4000 0010 reset value: 0x0000 5000 high-speed external clock control register 1 (clk_hsecr1) address: 0x4000 4004 reset value: 0x0000 000f 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 calint[4:0] clkfrac[10:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:11 calint[4:0]: divider value integer portion. bits 10:0 calint[10:0]: divider value fractional portion. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved biastrim[3:0] rw rw rw rw bits 31:4 reserved, must be kept at reset value bits 3:0 biastrim[3:0]: bias trim setting for 24-mhz oscillator. reset to full bias power up. may be overwritten in software.
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 58/285 docid16252 rev 15 high-speed internal clock control register (clk_hsicr) address: 0x4000 4008 reset value: 0x0000 0017 high-speed external clock comparator register (clk_hsecompr) address: 0x4000 400c reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved tune[4:0] rw rw rw rw rw bits 31:5 reserved, must be kept at reset value bits 4:0 tune[4:0]: frequency trim setting for the high-speed internal oscillator. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved hlevel llevel rr bits 31:2 reserved, must be kept at reset value bit 1 hlevel: high-level comparator output 1: high-level comparator output set. 0: high-level comparator output reset. bit 0 llevel: low-leve l comparator output 1: low-level comparator output set. 0: low-level comparator output reset.
docid16252 rev 15 59/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 clock period control register (clk_periodcr) address: 0x4000 4010 reset value: 0x0000 0000 clock period status register (clk_periodsr) address: 0x4000 4014 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved mode[1:0] rw rw bits 31:2 reserved, must be kept at reset value bits 1:0 mode[1:0]: sets the cl ock to be measured by clk_period 3: not used 2: measures tune_filter_result 1: measures hsi 0: measures lsi 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 period[15:0] rrrrrr r r r r r rr r r r bits 31:16 reserved, must be kept at reset value bits 15:0 period[15:0]: measures the number of 12 -mhz clock cycles in 16 or 256 periods (depending on the mode bits in the clk_perio dcr register) of the selected clock. 16 x 12 mhz clock period in lsi10k mode or 256 x 12 mhz clock period in hsi mode.
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 60/285 docid16252 rev 15 clock dither control re gister (clk_dithercr) address: 0x4000 4018 reset value: 0x0000 0000 high-speed external clock cont rol register 2 (clk_hsecr2) address: 0x4000 401c reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved dis rws bits 31:1 reserved, must be kept at reset value bit 0 dis: dither disable 1: dither enable 0: dither disable 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved en sw1 rws rws bits 31:2 reserved, must be kept at reset value bit 1 en: external high-speed clock enable when set to ?1?, the main clock is 24-mhz hse osc. 1: enables the 24-mhz hse osc. 0: disables the 24-mhz hse osc. bit 0 sw1: system clock switch 1: hse (external high-speed clock) is selected. 0: hsi (internal high-speed clock) is selected.
docid16252 rev 15 61/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 cpu clock control register (clk_cpucr) address: 0x4000 4020 reset value: 0x0000 0000 note: clock selection determines if the ram controller is running at the same speed as the pclk (sw2 = ?1?) or double speed of pclk (sw2 = ?0?). 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved sw2 rws bits 31:1 reserved, must be kept at reset value bit 0 sw2: switch clock 2 1: 24-mhz cpu clock selected 0: 12-mhz cpu clock selected
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 62/285 docid16252 rev 15 clock switching (clk) register map table 9 gives the clk register map and reset values. refer to figure 4: stm32w108xb memory mapping, figure 5: stm32w108cc and stm32w108cz memory mapping, and table 3: stm32w108xx peripheral register boundary addresses for the register boundary addresses of the peripherals available in all stm32w108xx devices. table 9. clk register map and reset values offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0x0008 clk_sleepcr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . lsi10ken lseen reset value 10 0x000c clk_lsi10kcr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . tune[3:0] reset value 0000 0x0010 clk_lsi1kcr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . calint[4:0] clkfrac[10:0] reset value 0101000000000000 0x0014- 0x4000 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . 0x4004 clk_hsecr1 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . biastrim [3:0] reset value 1111 0x4008 clk_hsicr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . tune[4:0] reset value 01111 0x400c clk_hsecompr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . hlevel llevel reset value 00 0x4010 clk_periodcr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . mode[1:0] reset value 00 0x4014 clk_periodsr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . period[15:0] reset value 0000000000000000 0x4018 clk_dithercr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . dis reset value 0 0x401c clk_hsecr2 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . en sw1 reset value 00 0x4020 clk_cpucr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . sw2 reset value 0
docid16252 rev 15 63/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 6.4 system timers 6.4.1 mac timer the stm32w108 devices integr ate a 20-bit counter (mactmr_cntr register) dedicated to the mac timer. the counting mode of the mac timer is controlled using the mactmr_cr register. this register (mactmr_cr) integrates two bits: one to enable the counting mode and the other to reset the value of the counter (mactmr_cntr register). 6.4.2 watchdog timer the stm32w108 integrates a watchdog timer which can be enabled to provide protection against software crashes and arm? cortex-m3 cpu lockup. by default, it is disabled at power up of the always-on power domain. th e watchdog timer uses the calibrated 1 khz clock (lsi1k) as its reference and provides a nominal 2.048 s timeout. a low water mark interrupt occurs at 1.792 s and triggers an nm i to the arm? cortex-m3 nvic as an early warning. when enabled, periodically reset the watchdog timer by writing to the wdg_kicksr register before it expires. the watchdog timer can be paused when the debugger halts the arm? cortex-m3. to enable this functionality, set the bi t dbgp bit in the slptmr_cr register. if the low-frequency internal rc oscillator (lsi10k) is turned off during deep sleep, lsi1k stops. as a consequence the watchdog timer stops counting and is effectively paused during deep sleep. the watchdog enable/disable bits are protecte d from accidental change by requiring a two step process. to enable the watchdog timer th e application must first write the enable code 0xeabe to the wdg_kr register an d then set the wdgen register bit. to disable the timer the application must write the disable code 0x dead to the wdg_kr register and then set the wdgdis register bit. 6.4.3 sleep timer the stm32w108 integrates a 32-bit timer dedicated to system timing and waking from sleep at specific times. the sleep ti mer can use either the calibrated 1 khz reference(lsi1k), or the 32 khz crystal clock (lse). the default clock source is the internal 1 khz clock. the sleep timer clock source is chosen with the clksel bit in the slptmr_cr register. the sleep timer has a prescaler, a divider of the form 2^n, where n can be programmed from 1 to 2^15. this divider allows for very long periods of sleep to be timed. the timer provides two compare outputs and wrap detection, all of which can be used to generate an interrupt or a wake up event. the sleep timer is paused when the debugger halts the arm? cortex-m3. no additional register bit must be set. to save current during deep sleep, the low-fr equency internal rc oscillator (lsi10k) can be turned off. if lsi10k is turned off during deep sleep and a low-frequency 32.768 khz crystal oscillator is not being used, then the sleep timer will not operate during deep sleep and sleep timer wake events cannot be used to wakeup the stm32w108.
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 64/285 docid16252 rev 15 6.4.4 event timer the systick timer is an arm? standard system timer in the nvic. the systick timer can be clocked from either the fclk (the clock going into the cpu) or the sleep timer clock. fclk is either the sclk or pc lk as selected by clk_cpucr (see section 6.3.5: clock switching on page 55 ). 6.4.5 slow timer (mac ti mer, watchdog, and sleeptimer) cont rol and status registers these registers are powered from the always-on power domain. all registers are only writ able when in system mode mactimer counter register (mactmr_cntr) address: 0x4000 2038 reset value: 0x0000 0000 mactimer counter register (mactmr_cr) address: 0x4000 208c reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved cnt[19:16] rw rw rw rw 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 cnt[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:20 reserved, must be kept at reset value bits 19:0 cnt[19:0]: mac timer counter value 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved rst en rw rw bits 31:2 reserved, must be kept at reset value bit 1 rst: mac timer reset bit 0 en: mac timer enable
docid16252 rev 15 65/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 watchdog control register (wdg_cr) register bits for general top level chip functions and protection. watchdog bits can only be written after firs t writing the appropriate code to the wdg_kr register. address: 0x4000 6000 reset value: 0x0000 0002 watchdog key register (wdg_kr) requires magic number write to arm the watchdog enable or disable function. address: 0x4000 6004 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved wdg dis wdg en rw rw bits 31:2 reserved, must be kept at reset value bit 1 wdgdis: watchdog disable bit 0 wdgen: watchdog enable 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 key[15:0] wwwwww w w w w w ww w w w bits 31:16 reserved, must be kept at reset value bits 15:0 key[15:0]: write 0xdead to disable or 0xeabe to enable.
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 66/285 docid16252 rev 15 watchdog kick-start register (wdg_kicksr) write any value to this register to kick-start the watchdog. address: 0x4000 6008 reset value: 0x0000 0000 sleep timer configuration register (slptmr_cr) this register sets the various options for the sleep timer. address: 0x4000 600c reset value: 0x0000 0400 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ks[15:0] wwwwww w w w w w ww w w w bits 31:16 reserved, must be kept at reset value bits 15:0 ks[15:0]: watchdog kick-start value: write any value to restart the watchdog. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved reverse en dbgp reserved psc[3:0] reserved clk sel rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bit 12 reverse: 0: count forward 1: count backwards only changes when en is set to ?0? bit 11 en: 0: disable sleep timer 1: enable sleep timer to change other register bits (reverse, ps c, clksel), this bit must be set to ?0?. enabling/disabling latency can be up 2 to 3 clock-periods of selected clock.
docid16252 rev 15 67/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 sleep timer count high register (slptmr_cnth) address: 0x4000 6010 reset value: 0x0000 0000 bit 10 dbgp: debug pause 0: the timer continues working in debug mode. 1: the timer is paused in debug mode when the cpu is halted. bits 9:8 reserved, must be kept at reset value bits 7:4 psc[3:0]: sleep timer prescaler setting divides clock by 2 n where n = 0 to 15. can only be changed when the en is set to ?0?. bits 3:1 reserved, must be kept at reset value bit 0 clksel: clock select 0: calibrated 1khz rc clock (default); 1: 32khz. can only be changed when the en is set to ?0?. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 cnth[15:0] rrrrrr r r r r r rr r r r bits 31:16 reserved, must be kept at reset value bits 15:0 cnth[15:0]: sleep timer counter high value reading this register updates the sleep_cntl for subsequent reads.
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 68/285 docid16252 rev 15 sleep timer count low register (slptmr_cntl) address: 0x4000 6014 reset value: 0x0000 0000 sleep timer compare a high register (slptmr_cmpah) address: 0x4000 6018 reset value: 0x0000 ffff 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 cntl[15:0] rrrrrr r r r r r rr r r r bits 31:16 reserved, must be kept at reset value bits 15:0 cntl[15:0]: sleep timer counter low value this register is only valid following a read of the slptmr_cnth register. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 cmpah[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:0 cmpah[15:0]: sleep timer compare a high value sleep timer compare value - writing to this register updates the slptmr_cmpah register directly and updates the slptmr_cmpal regist er from the hold register. this value can only be changed when the sleep timer is disabled (en bit set to 0 in the slptmr_cr register). if the value is changed when the sleep timer is enabled (en bit set to ?1? in the slptmr_cr register), a spurious interrupt ma y be generated. therefor e it is recommended to disable sleep timer interrupts before changing this register.
docid16252 rev 15 69/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 sleep timer compare a low register (slptmr_cmpal) address: 0x4000 601c reset value: 0x0000 ffff sleep timer compare b high register (slptmr_cmpbh) address: 0x4000 6020 reset value: 0x0000 ffff 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 cmpal[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:0 cmpal[15:0]: sleep timer compare a low value writing to this register puts the value in the hold register until a write to the slptmr_cmpah register. the value can only be changed when the sleep timer is disabled (en bit set to ?0? in the slptmr_cr register). if the value is changed when the sleep timer is enabled (en bit set to ?1? in the slptmr_cr register) a spuri ous interrupt may be gener ated. therefore it is recommended to disable interrupts before changing this register. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 cmpbh[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:0 cmpbh[15:0]: sleep timer compare b high value sleep timer compare value - writing to this register updates the slptmr_cmpbh register directly and updates the slptmr_cmpbl regist er from the hold register. this value can only be changed when the en (bit 11 of slptmr_cr register) is set to ?0?. if the value is changed when the en bit is set to ?1?, a spurious interrupt may be generated. therefore it is recommended to disable interrupts before changing this register.
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 70/285 docid16252 rev 15 sleep timer compare b low register (slptmr_cmpbl) address: 0x4000 6024 reset value: 0x0000 ffff sleep timer interrupt source register (slptmr_isr) address: 0x4000 a014 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 cmpbl[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:0 cmpbl[15:0]: sleep timer compare b low value writing to this register puts the value in th e hold register until a write to the slptmr_cmpbh register. the value can only be changed when the sleep timer is enabled (en bit set to ?0? in the slptmr_cr register) is set to ?0?. if the value is changed when the sleep timer is enabled (en bit set to ?1? in the slptmr_cr register), a spurious interrupt may be generated. therefore it is reco mmended to disable interrupts before changing this register. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved cmpb cmpa wrap rw rw rw bits 31:3 reserved, must be kept at reset value bit 2 cmpb: sleep timer compare b bit 1 cmpa: sleep timer compare a bit 0 wrap: sleep timer wrap
docid16252 rev 15 71/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 sleep timer force interrupt register (slptmr_ifr) address: 0x4000 a020 reset value: 0x0000 0000 sleep timer interrupt enable register (slptmr_ier) address: 0x4000 a054 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved cmpb cmpa wrap rw rw rw bits 31:3 reserved, must be kept at reset value bit 2 cmpb: force sleep timer compare b interrupt bit 1 cmpa: force sleep timer compare a interrupt bit 0 wrap: force sleep timer wrap interrupt 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved cmpb cmpa wrap rw rw rw bits 31:3 reserved, must be kept at reset value bit 2 cmpb: sleep timer compare b bit 1 cmpa: sleep timer compare a bit 0 wrap: sleep timer wrap
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 72/285 docid16252 rev 15 mac timer (mactmr)/watchdog (wdg)/sleeptimer(slptmr) register map table 10 gives the mactmr, wdg, and slptmr register map and reset values. table 10. mactmr, wdg, and slptmr register map and reset values offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0x2038 mactmr_cntr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cnt[19:0] reset value 00000000000000000000 0x208c mactmr_cr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . rst en reset value 00 0x6000 wdg_cr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . wdgdis wdgen reset value 10 0x6004 wdg_kr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . key[15:0] reset value 0000000000000000 0x6008 wdg_kicksr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . ks[15:0] reset value 0000000000000000 0x600c slptmr_cr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . reverse en dbgp re s . re s . psc[3:0] re s . re s . re s . clksel reset value 001 0000 0 0x6010 slptmr_cnth re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cnth[15:0] reset value 0000000000000000 0x6014 slptmr_cntl re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cntl[15:0] reset value 0000000000000000 0x6018 slptmr_cmpah re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cmpah[15:0] reset value 0000000000000000 0x601c slptmr_cmpal re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cmpal[15:0] reset value 0000000000000000 0x6020 slptmr_cmpbh re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cmpbh[15:0] reset value 0000000000000000 0x6024 slptmr_cmpbl re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cmpbl[15:0] reset value 0000000000000000 0xa014 slptmr_isr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cmpb cmpa wrap reset value 000 0xa020 slptmr_ifr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cmpb cmpa wrap reset value 000
docid16252 rev 15 73/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 refer to figure 4: stm32w108xb memory mapping, figure 5: stm32w108cc and stm32w108cz memory mapping, and table 3: stm32w108xx peripheral register boundary addresses for the register boundary addresses of the peripherals available in all stm32w108xx devices. 6.5 power management the stm32w108's power management system is designed to achieve the lowest deep sleep current consumption possible while still providing flexible wakeup sources, timer activity, and debugger operation. the stm32w108 has four main sleep modes: ? idle sleep: puts the cpu into an idle st ate where execution is suspended until any interrupt occurs. all power domains rema in fully powered and nothing is reset. ? deep sleep 1: the primary deep sleep state. in this state, the core power domain is fully powered down and the sleep timer is active ? deep sleep 2: the same as deep sleep 1 except that the sleep timer is inactive to save power. in this mode the sleep timer cannot wakeup the stm32w108. ? deep sleep 0 (also known as emulated deep sleep): the chip emulates a true deep sleep without powering down the core dom ain. instead, the core domain remains powered and all peripherals except the system debug components (itm, dwt, fpb, nvic) are held in reset. the purpose of this sleep state is to allow stm32w108 software to perform a deep sleep cycle while maintaining debug configuration such as breakpoints. 6.5.1 wake sources when in deep sleep the stm32w108 can be returned to the running state in a number of ways, and the wake sources are split depending on deep sleep 1 or deep sleep 2. 0xa054 slptmr_ier re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cmpb cmpa wrap reset value 000 table 10. mactmr, wdg, and slptmr register map and reset values (continued) offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 74/285 docid16252 rev 15 the following wake sources are available in both deep sleep 1 and 2. ? wake on gpio activity: wake due to change of state on any gpio. ? wake on serial controller 1: wake due to a change of state on gpio pin pb2. ? wake on serial controller 2: wake due to a change of state on gpio pin pa2. ? wake on irqd: wake due to a change of state on irqd. since irqd can be configured to point to any gpio, this wake source is another means of waking on any gpio activity. ? wake on setting of cdbgpwrupreq: wa ke due to setting the cdbgpwrupreq bit in the debug port in the swj. ? wake on setting of csyspwrupreq: wake due to setting the csyspwrupreq bit in the debug port in the swj. the following sources are only available in deep sl eep 1 since the sleep timer is not active in deep sleep 2. ? wake on sleep timer compare a. ? wake on sleep timer compare b. ? wake on sleep timer wrap. the following source is only available in deep sleep 0 since the swj is required to write memory to set this wake source and the sw j only has access to so me registers in deep sleep 0. ? wake on write to the corewake bi t in the pwr_wakecr2 register. the wakeup recording module monitors all possible wakeup sources. more than one wakeup source may be recorded because events are continually being recorded (not just in deep-sleep), since another event may happen between the first wake event and when the stm32w108 wakes up.
docid16252 rev 15 75/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 6.5.2 basic sleep modes the power management state diagram in figure 8 shows the basic operation of the power management controller. figure 8. power mana gement state diagram deep sleep emulated deep sleep pre- deep sleep running idle sleep cdbgpwrupreq set cdbgpwrupreq cleared deep sleep requested (wfi instruction with sleep_deep=1) interru p t sleep r eque s t e d ( wf i i nst r uc tio n w ith s le e p _d e e p= 0) csyspwrupreq & inhibit cdbgpwrupreq=0 & csyspwrupreq=0 wake up event or csyspwrupreq set (resets the processor) w a k e u p e v e n t ( r e s e t s t h e p r o c e s s o r ) c d b g p w r u p r e q = 1 & c s y s p w r u p r e q = 0
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 76/285 docid16252 rev 15 in normal operation an application may request one of two low power modes through program execution: ? idle sleep is achieved by executing a wfi instruction whilst the sleepdeep bit in the cortex system control register (scs_scr) is clear (for more details refer to the cortex-m3 programming manual pm0056). this puts the cpu into an idle state where execution is suspended until an interrupt occu rs. this is indicated by the state at the bottom of the diagram. power is maintained to the core logic of the stm32w108 during the idle sleeping state. ? deep sleep is achieved by executing a wfi instructi on whilst the sleepdeep bit in the cortex system control register (scs_scr ) is set (for more details refer to the cortex-m3 programming manual pm0056). this triggers the state transitions around the main loop of the diagram, resulting in powering down the stm32w108's core logic, and leaving only the always-on domain powered. wake up is triggered when one of the pre-determined events occurs. if a deep sleep is requested the stm32w108 first enters a pre-deep sleep state. this state prevents any section of the chip from being powered off or reset until the swj goes idle (by clearing csyspwrupreq). this pre-deep sleep stat e ensures debug o perations are not interrupted. in the deep sleep state the stm32w108 waits for a wake up event which will return it to the running state. in powering up the core logic the arm? cortex-m3 is put through a reset cycle and st software restores the stack and application state to the point where deep sleep was invoked. 6.5.3 further options for deep sleep by default, the low-freq uency internal rc oscillator (lsi10 k) is running du ring deep sleep (known as deep sleep 1). to conserve power, lsi10k can be turned off during deep sleep. this mode is known as deep sleep 2. since the lsi10k is disabled, the sleep timer and watchdog timer do not function and cannot wake the chip unless the low-frequency 32.7 68 khz crystal oscillator is used. non-timer based wake sources continue to function. once a wa ke event occurs, the lsi10k restarts and becomes enabled. 6.5.4 use of debugger with sleep modes the debugger communicates with the stm32w108 using the swj. when the debugger is connected, the cdbgpwr upreq bit in the debug port in the swj is set, the stm32w108 will only enter deep sleep 0 (the emul ated deep sleep state). the cdbgpwrupreq bit indicates that a debug tool is connected to the chip and therefore there may be debug state in the system debug components. to maintain the state in the system debug components only deep sleep 0 may be used, since deep sleep 0 will not cause a power cycle or reset of the core domain. the csyspwrupreq bit in the debug port in the swj indicates that a debugger wants to access memory actively in the stm32w108. therefore, whenever the csyspw rupreq bit is set while the stm32w108 is awake, the stm32w108 cannot enter deep sleep until this bit is clea red. this ensures the stm32w108 does not disrupt debug communication into memory.
docid16252 rev 15 77/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 clearing both csyspwrupreq and cdbgpwr upreq allows the stm32w108 to achieve a true deep sleep state (deep sleep 1 or 2). both of these signals also operate as wake sources, so that when a debugger connects to the stm32w108 and begins accessing the chip, the stm32w108 automatically comes out of deep sleep. when the debugger initiates access while the stm32w108 is in de ep sleep, the swj inte lligently holds off the debugger for a brief period of time until the stm32w108 is properly powered and ready. for more information regarding the swj and the interaction of debuggers with deep sleep, contact st support for application notes and arm? coresight documentation. 6.5.5 power management registers power deep sleep control register 1 (pwr_dsleepcr1) address: 0x4000 0004 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved lvfreez e reserved rw bits 31:2 reserved, must be kept at reset value bit 1 lvfreeze: lv freeze state 1: enables lv freez e output states 0: disables gpio freeze bit 0 reserved, must be kept at reset value
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 78/285 docid16252 rev 15 power deep sleep control register 2 (pwr_dsleepcr2) address: 0x4000 0014 reset value: 0x0000 0001 power voltage regulator control register (pwr_vregcr) address: 0x4000 0018 reset value: 0x0000 0204 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved mode rw bits 31:1 reserved, must be kept at reset value bit 0 mode: this bit is used only when the debugger is attached to enable deep sleep mode 0. 1: enables deep sleep mode 0 when the debugger is attached (default condition). 0: disables deep sleep mode 0 when the debugger is attached (the cpu is in deep sleep mode 1 or 2). 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved 1v8en reserved 1v8trim[2:0] reserved 1v2en reserved 1v2trim[2:0] rws rw rw rw rws rw rw rw bits 31:12 reserved, must be kept at reset value bit 11 1v8en: 1v8 direct control of regulator on/off 1: 1v8 regulator on 0: 1v8 regulator off bit 10 reserved, must be kept at reset value bits 9:7 1v8trim: 1v8 regulator trim value bits 6:5 reserved, must be kept at reset value bit 4 1v2en: 1v2 direct control of regulator on/off 1: 1v2 regulator on 0: 1v2 regulator off bit 3 reserved, must be kept at reset value bits 2:0 1v2trim: 1v2 regulator trim value
docid16252 rev 15 79/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 power wakeup event control register 1 (pwr_wakecr1) address: 0x4000 0020 reset value: 0x0000 0200 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved crysp wrup req cpwr rup req core wrap compb comp a irqd sc2 sc1 wak een rw rw rw rw rw rws rw rw rw rw bits 31:10 reserved, must be kept at reset value bit 9 csyspwrupreq: wakeup on the csyspwrupr eq event (move to running from deep sleep 0). 1: enables wakeup on csyspwrupreq event 0: disables wakeup on csyspwrupreq event bit 8 cpwrrupreq: wakeup on the cpwrupreq event (move to running from deep sleep 0) 1: enables wakeup on cpwrupreq event 0: disables wakeup on cpwrupreq event bit 7 core: wakeup on write to wake_core bit 1: enables wakeup on write to wake_core bit 0: disables wakeup on write to wake_core bit bit 6 wrap: wakeup on sleep timer compare wrap/overflow event 1: enables wakeup on sleep timer compare wrap/overflow event 0: disables wakeup on sleep timer compare wrap/overflow event bit 5 compb: wake up on sleep timer compare b event 1: enables wakeup on sleep timer compare b event 0: disables wakeup on sleep timer compare b event bit 4 compa: wakeup on sleep timer compare a event 1: enables wakeup on sleep timer compare a event 0: disables wakeup on sleep timer compare a event bit 3 irqd: wakeup on irqd event 1: enables wakeup on irqd event 0: disables wakeup on irqd event bit 2 sc2: wakeup on sc2 event 1: enables wakeup on sc2 event 0: disables wakeup on sc2 event bit 1 sc1: wakeup on sc1 event 1: enables wakeup on sc1 event 0: disables wakeup on sc1 event bit 0 wakeen: enable gpio wakeup monitoring 1: enables gpio wakeup monitoring 0: disables gpio wakeup monitoring
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 80/285 docid16252 rev 15 power wakeup event control register 2 (pwr_wakecr2) address: 0x4000 0024 reset value: 0x0000 0000 power wakeup event status register (pwr_wakesr) address: 0x4000 0028 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved core wake reserved w bits 31:10 reserved, must be kept at reset value bit 5 corewake: power-up controlled by debug port ac tivity. write to this bit to wake core from deep sleep 0. bits 4:0 reserved, must be kept at reset value 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved crysp wrup req cpwr rup req core wrap compb comp a irqd sc2 sc1 gpio pin rw rw rw rw rw rw rw rw rw rw bits 31:10 reserved, must be kept at reset value bit 9 csyspwrupreq: indicates that a debug access port (dap) access to the sys registers triggered the wake event. 0: wakeup on csyspwrup req event not detected 1: wakeup on csyspw rupreq event detected bit 8 cpwrrupreq: wake indicates that a dap acce ss to the dbg registers triggered the wake event. 0: wakeup on cpwrrupreq event not detected 1: wakeup on cpwrrupreq event detected bit 7 core: wakeup on debug port activity 0: wakeup on core event not detected 1: wakeup on core event detected
docid16252 rev 15 81/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 power cpwrupreq status register (pwr_cpwrupreqsr) address: 0x4000 0034 reset value: 0x0000 0000 bit 6 wrap: sleep timer wrap 0: wakeup on wrap event not detected 1: wakeup on wrap event detected bit 5 compb: sleep timer compare b 0: wakeup on compb event not detected 1: wakeup on compb event detected bit 4 compa: sleep timer compare a 0: wake up on compa event not detected 1: wake up on compa event detected bit 3 irqd: change of gpio pin for external interrupt irqd 0: wakeup on irqd event not detected 1: wakeup on irqd event detected bit 2 sc2: serial control 2 0: wakeup on sc2 event not detected 1: wakeup on sc2 event detected bit 1 sc1: serial control 1 0: wakeup on sc1 event not detected 1: wakeup on sc1 event detected bit 0 gpiopin: change of programmable gpio pi n (programmable with gpio wakeup monitoring) 0: wakeup on gpio pin not detected 1: wakeup on gpio pin detected 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved req r bits 31:1 reserved, must be kept at reset value bit 0 req: status of the spwrupreq
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 82/285 docid16252 rev 15 power csyspwrupreq status register (pwr_csyspwrupreqsr) address: 0x4000 0038 reset value: 0x0000 0000 power csyspwrupack status register (pwr_csyspwrupacksr) address: 0x4000 003c reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved req r bits 31:1 reserved, must be kept at reset value bit 0 req: status of the csyspwrupreq 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved ack r bits 31:1 reserved, must be kept at reset value bit 0 ack: status of the csyspwrupack
docid16252 rev 15 83/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 power csyspwrupack control r egister (pwr_csyspwrupackcr) address: 0x4000 0040 reset value: 0x0000 0000 power gpio wakeup monitoring port a register (pwr_wakepar) address: 0x4000 bc08 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved inhibit rw bits 31:1 reserved, must be kept at reset value bit 0 inhibit: value of csyspwrupack_inhibit (cleared by the po wer management state machine as part of power-down sequence). 1: inhibits csyspwrupack 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 rw rw rw rw rw rw rw rw bits 31:8 reserved, must be kept at reset value bit 7 pa7 1: enables gpio wakeup on pin gpio[ 7] changing state 0: disables gpio wakeup on pin gpio[ 7] changing state bit 6 pa6 1: enables gpio wakeup on pin gpio[ 6] changing state 0: disables gpio wakeup on pin gpio[ 6] changing state bit 5 pa5 1: enables gpio wakeup on pin gpio[ 5] changing state 0: disables gpio wakeup on pin gpio[ 5] changing state bit 4 pa4 1: enables gpio wakeup on pin gpio[ 4] changing state 0: disables gpio wakeup on pin gpio[ 4] changing state
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 84/285 docid16252 rev 15 power gpio wakeup monitoring port b register (pwr_wakepbr) address: 0x4000 bc0c reset value: 0x0000 0000 bit 3 pa3 1: enables gpio wakeup on pin gpio[ 3] changing state 0: disables gpio wakeup on pin gpio[ 3] changing state bit 2 pa2 1: enables gpio wakeup on pin gpio[ 2] changing state 0: disables gpio wakeup on pin gpio[ 2] changing state bit 1 pa1 1: enables gpio wakeup on pin gpio[ 1] changing state 0: disables gpio wakeup on pin gpio[ 1] changing state bit 0 pa0 1: enables gpio wakeup on pin gpio[ 0] changing state 0: disables gpio wakeup on pin gpio[ 0] changing state 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 rw rw rw rw rw rw rw rw bits 31:8 reserved, must be kept at reset value bit 7 pb7 1: enables gpio wakeup on pin gpio[ 7] changing state 0: disables gpio wakeup on pin gpio[ 7] changing state bit 6 pb6 1: enables gpio wakeup on pin gpio[ 6] changing state 0: disables gpio wakeup on pin gpio[ 6] changing state bit 5 pb5 1: enables gpio wakeup on pin gpio[ 5] changing state 0: disables gpio wakeup on pin gpio[ 5] changing state bit 4 pb4 1: enables gpio wakeup on pin gpio[ 4] changing state 0: disables gpio wakeup on pin gpio[ 4] changing state bit 3 pb3 1: enables gpio wakeup on pin gpio[ 3] changing state 0: disables gpio wakeup on pin gpio[ 3] changing state bit 2 pb2 1: enables gpio wakeup on pin gpio[ 2] changing state 0: disables gpio wakeup on pin gpio[ 2] changing state
docid16252 rev 15 85/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 power gpio wakeup monitoring port c register (pwr_wakepcr) address: 0x4000 bc10 reset value: 0x0000 0000 bit 1 pb1 1: enables gpio wakeup on pin gpio[ 1] changing state 0: disables gpio wakeup on pin gpio[ 1] changing state bit 0 pb0 1: enables gpio wakeup on pin gpio[ 0] changing state 0: disables gpio wakeup on pin gpio[ 0] changing state 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 rw rw rw rw rw rw rw rw bits 31:8 reserved, must be kept at reset value bit 7 pc7 1: enables gpio wakeup on pin gpio[ 7] changing state 0: disables gpio wakeup on pin gpio[ 7] changing state bit 6 pc6 1: enables gpio wakeup on pin gpio[ 6] changing state 0: disables gpio wakeup on pin gpio[ 6] changing state bit 5 pc5 1: enables gpio wakeup on pin gpio[ 5] changing state 0: disables gpio wakeup on pin gpio[ 5] changing state bit 4 pc4 1: enables gpio wakeup on pin gpio[ 4] changing state 0: disables gpio wakeup on pin gpio[ 4] changing state bit 3 pc3 1: enables gpio wakeup on pin gpio[ 3] changing state 0: disables gpio wakeup on pin gpio[ 3] changing state bit 2 pc2 1: enables gpio wakeup on pin gpio[ 2] changing state 0: disables gpio wakeup on pin gpio[ 2] changing state bit 1 pc1 1: enables gpio wakeup on pin gpio[ 1] changing state 0: disables gpio wakeup on pin gpio[ 1] changing state bit 0 pc0 1: enables gpio wakeup on pin gpio[ 0] changing state 0: disables gpio wakeup on pin gpio[ 0] changing state
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 86/285 docid16252 rev 15 power wakeup filter register (pwr_wakefiltr) address: 0x4000 bc1c reset value: 0x0000 000f power management (pwr) register map table 11 gives the pwr register map and reset values. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved irqd sc2 sc1 gpio pin rw rw rw rw bits 31:4 reserved, must be kept at reset value bit 3 irqd_wake_filter: enables filter on gpio wakeup source irqd bit 2 sc2_wake_filter: enables filter on gpio wakeup source sc2 (pa2) bit 1 sc1_wake_filter: enables filter on gpio wakeup source sc1 (pb2) bit 0 gpio_wake_filter: enables filter on gpio wakeup sources enabled by the pwr_wakepar, pwr_wakepbr, and pwr_wakepcr registers. table 11. pwr register map and reset values offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0x0004 pwr_dsleepcr1 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . lvfreeze re s . reset value 0 0x0008- 0x0010 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . 0x0014 pwr_dsleepcr2 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . mode reset value 0 0x0018 pwr_vregcr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . 1v8en re s . 1v8trim [2:0] re s . re s . 1v2en re s . 1v2trim [2:0] reset value 0100 0111 0x001c re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s .
docid16252 rev 15 87/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz system modules 281 0x0020 pwr_wakecr1 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . csyspwrupreq cpwrrupreq core wrap compb compa irqd sc2 sc1 wakeen reset value 1000000000 0x0024 pwr_wakecr2 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . corewake re s . re s . re s . re s . re s . reset value 0 0x0028 pwr_wakesr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . csyspwrupreq cpwrrupreq core wrap compb compa irqd sc2 sc1 gpiopin reset value 0000000000 0x002c- 0x0030 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . 0x0034 pwr_cpwrup reqsr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . req reset value 0 0x0038 pwr_csyspwrup reqsr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . req reset value 0 0x003c pwr_csyspwrup acksr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . ack reset value 0 0x0040 pwr_csyspwrup ackcr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . inhibit reset value 0 0x0044- 0xbc04 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . 0xbc08 pwr_wakepar re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . pa7 pa6 pa5 pa4 pa3 pa2 pa1 pa0 reset value 00000000 0xbc0c pwr_wakepbr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . pb7 pb6 pb5 pb4 pb3 pb2 pb1 pb0 reset value 00000000 0xbc10 pwr_wakepcr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . pc7 pc6 pc5 pc4 pc3 pc2 pc1 pc0 reset value 00000000 0xbc14- 0xbc18 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . 0xbc1c pwr_wakefiltr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . irqd sc2 sc1 gpiopin reset value 0000 table 11. pwr register map and reset values (continued) offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
system modules stm32w108hb stm32w108cc stm32w108cb stm32w108cz 88/285 docid16252 rev 15 refer to figure 4: stm32w108xb memory mapping, figure 5: stm32w108cc and stm32w108cz memory mapping, and table 3: stm32w108xx peripheral register boundary addresses for the register boundary addresses of the peripherals available in all stm32w108xx devices. 6.6 security accelerator the stm32w108 contains a hardware aes encryption engine accessible from the arm? cortex-m3. nist-based ccm, ccm, cbc-mac, and ctr modes are implemented in hardware. these modes are de scribed in the ieee 802.15.4-2003 specif ication, with the exception of ccm, which is described in the zigbee security services specification 1.0.
docid16252 rev 15 89/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz integrated voltage regulator 281 7 integrated voltage regulator the stm32w108 integrates two low dropout regulators to provide 1.8 v and 1.25 v power supplies. the 1v8 regulator supplies the analog and memories, and the 1v25 regulator supplies the digital core. in deep sleep the voltage regulators are disabled. when enabled, the 1v8 regulator steps down the pads supply voltage (vdd_pads) from a nominal 3.0 v to 1.8 v. the regulator output pin (vreg_out) must be decoupled externally with a suitable capacitor. vreg_out should be connected to the 1.8 v supply pins vdda, vdd_rf, vdd_vco, vdd_synth, vdd_if, and vdd_mem. the 1v8 regulator can supply a maximum of 50 ma. when enabled, the 1v25 regulator steps down vdd_pads to 1.25 v. the regulator output pin (vdd_core, (pin 17) must be decoupled exte rnally with a suitable capacitor. it should connect to the other vdd_core pin (pin 44). the 1v25 regulator can supply a maximum of 10 ma. the regulators are controlled by the digital portion of the chip as described in section 6: system modules . table 12. 1.8 v integrated voltage regulator specifications parameter min. typ. max. units comments supply range for regulator 2.1 3.6 v vdd_pads 1v8 regulator output -5% 1.8 +5% v regulator output after initialization 1v8 regulator output after reset -5% 1.75 +5% regulator output after reset 1v25 regulator output -5% 1.25 +5% v regulator output after initialization 1v25 regulator output after reset -5% 1.45 +5% regulator output after reset 1v8 regulator capacitor 2.2 f low esr tantalum capacitor esr greater than 2 esr less than 10 de-coupling less than100 nf ceramic 1v25 regulator capacitor 1.0 f ceramic capacitor (0603) 1v8 regulator output current 0 50 ma regulator output current 1v25 regulator output current 0 10 ma regulator output current no load current 600 a no load current (bandgap and regulators) 1v8 regulator current limit 200 ma short circuit current limit 1v25 regulator current limit 25 ma short circuit current limit
integrated voltage regulator stm32w108hb stm32w108cc stm32w108cb stm32w108cz 90/285 docid16252 rev 15 an external 1.8 v regulator may replace both internal regulators. the stm32w108 can control external regulators during deep sleep using open-drain gpio pa7, as described in section 8: general-purpose input/output . the stm32w108 drives pa7 low during deep sleep to disable the external re gulator and an external pull-up is required to release this signal to indicate that supp ly voltage should be provided. current consumption increases approximately 2 ma when using an external regulator. when using an external regulator the internal regulators should be disabled through software. 1v8 regulator start-up time 50 s 0 v to por threshold 2.2 f capacitor 1v25 regulator start-up time 50 s 0 v to por threshold 1.0 f capacitor table 12. 1.8 v integrated voltage regulator specifications (continued) parameter min. typ. max. units comments
docid16252 rev 15 91/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose input/output 281 8 general-purpose input/output the stm32w108 has 24 multi-purpose gpio pins that may be individually configured as: ? general purpose output ? general purpose open-drain output ? alternate output controll ed by a peripheral device ? alternate open-drain output controlled by a peripheral device ? analog ? general purpose input ? general purpose input with pull-up or pull-down resistor the basic structure of a sing le gpio is illustrated in figure 9 . figure 9. gpio block diagram a schmitt trigger converts the gpio pin voltage to a digital input value. the digital input signal is then always routed to the gpiox_idr re gister; to the alternate inputs of associated peripheral devices; to wake detection logic if wake detection is enabled; and, for certain pins, to interrupt generation logic. configuring a pin in analog mode disconnects the digital input from the pin and applies a high logic level to the input of the schmitt trigger. only one device at a time can control a gpio output. the output is controlled in normal output mode by the gpiox_odr register and in alternate output mode by a peripheral device. when in input mode or analog mode, digital output is disabled. gpiox_odr gpiox_bsr gpiox_waker alternate output analog functions wake detection pin alternate input vdd_pads gnd vdd_pads gnd output control (push pull , open drain , or disabled ) schmitt trigger vdd_pads gnd protection diode protection diode p-mos n-mos gpiox_crh/l gpiox_idr gpiox_brr
general-purpose input/output stm32w108hb stm32w108cc stm32w108cb stm32w108cz 92/285 docid16252 rev 15 8.1 functional description 8.1.1 gpio ports the 24 gpio pins are grouped into three port s: pa, pb, and pc. individual gpios within a port are numbered 0 to 7 according to thei r bit positions within the gpio registers. note: because gpio port registers' functions are iden tical, the notation x is used here to refer to a, b, or c. for example, gpiox_idr refers to the registers gpioa_idr, gpiob_idr, and gpioc_idr. each of the three gpio ports has the following registers whose low-order eight bits correspond to the port's eight gpio pins: ? gpiox_idr (input data register) returns the pin level (unless in analog mode). ? gpiox_odr (output data register) controls the output level in normal output mode. ? gpiox_brr (clear output data register) clears bits in gpiox_odr. ? gpiox_bsr (set output data register) sets bits in gpiox_odr. ? pwr_wakepxr (wake monitor register) s pecifies the pins that can wake the stm32w108. in addition to these registers, each port has a pair of configuration registers, gpiox_crh and gpiox_crl. these registers specify t he basic operating mode for the port's pins. gpiox_crl configures the pins cnfmode3[ 3:0], cnfmode2[3:0], cnfmode1[3:0], and cnfmode0[3:0]. gpiox_crh configures the pins cnfmode7[3:0], cnfmode6[3:0], cnfmode5[3:0], and cnfmode4[3:0]. henceforth , the notation gpiox_crh/l is used to refer to the pair of configuration registers. five gpio pins (pa6, pa7, pb6, pb7 and pc0) can sink and source higher current than standard gpio outputs. refer to table 65: digital i/o characteristics on page 265 for more information.
docid16252 rev 15 93/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose input/output 281 8.1.2 configuration each pin has a 4-bit configuration value in the gpiox_crh/l register. the various gpio modes and their 4 bit configur ation values are shown in table 13 . if a gpio has two peripherals that can be th e source of alternate output mode data, then other registers in addition to gpiox_crh/l determine which peripheral controls the output. several gpios share an alternate output with timer 2 and the serial controllers. bits in timer 2's tim2_or register control routing timer 2 outputs to different gpios. bits in timer 2's tim2_ccer register enable timer 2 out puts. when timer 2 outputs are enabled they override serial controller outputs. table 14 indicates the gpio mapping for timer 2 outputs depending on the bits in the register tim2_or. refer to section 10: general-purpose timers on page 159 for complete information on timer configuration. for outputs assigned to the serial controllers, the serial interface mode registers (scx_cr) determine how the gpio pins are used. table 13. gpio configuration modes gpio mode gpiox_crh/l description analog 0x0 analog input or output. when in analog mode, the digital input (gpiox_idr) always reads 1. input (floating) 0x4 digital input without an inte rnal pull up or pull down. output is disabled. input (pull-up or pull-down) 0x8 digital input with an internal pull up or pull down. a set bit in gpiox_odr selects pull up and a cleared bit selects pull down. output is disabled. output (push-pull) 0x1 push-pull output. gpiox_odr controls the output. output (open-drain) 0x5 open-drain output. gpiox_odr controls the output. if a pull up is required, it must be external. alternate output (push-pull) 0x9 push-pull output. an onboard peripheral controls the output. alternate output (open-drain) 0xd open-drain output. an onboard peripheral controls the output. if a pull up is required, it must be external. alternate output (push-pull) spi sclk mode 0xb push-pull output mode only for spi master mode sclk pins. table 14. timer 2 output configuration controls timer 2 output option register bit gpio mapping selected by tim2_or bit 01 tim2_ch1 tim2_or[4] pa0 pb1 tim2_ch2 tim2_or[5] pa3 pb2 tim2_ch3 tim2_or[6] pa1 pb3 tim2_ch4 tim2_or[7] pa2 pb4
general-purpose input/output stm32w108hb stm32w108cc stm32w108cb stm32w108cz 94/285 docid16252 rev 15 the alternate outputs of pa4 and pa5 can either provide packet trace data (pti_en and pti_data), or synchronous cpu trace data (tracedata2 and tracedata3). if a gpio does not have an associated peripheral in alternate output mode, its output is set to 0. 8.1.3 forced functions for some gpios the gpiox_crh/l configuration may be overridden. table 15 shows the gpios that can have different functions fo rced on them regardless of the gpiox_crh/l registers. note: the debug_dis bit in the gpio_dbgcr register can disable the serial wire/jtag debugger interface. when this bit is set, al l debugger-related pins (pc0, pc2, pc3, pc4) behave as standard gpio. 8.1.4 reset a full chip reset is one due to power on (low or high voltage), the nrst pin, the watchdog, or the sysresetreq bit. a full ch ip reset affects the gpio configuration as follows: ? the gpiox_crh/l configurations of all pi ns are configured as floating inputs. ? the extregen bit is set in the gpio_dbgcr register, which overrides the normal configuration for pa7. ? the dbgdis bit in the gpio_dbgcr register is cleared, allowing serial wire/jtag access to override the normal config uration of pc0, pc2, pc3, and pc4. table 15. gpio forced functions gpio override condition forced function forced signal pa7 extregen bit set in the gpio_dbgcr register open-drain output reg_en pc0 debugger interface is active in jtag mode input with pull up jrst pc2 debugger interface is active in jtag mode push-pull output jtdo pc3 debugger interface is active in jtag mode input with pull up jdti pc4 debugger interface is active in jtag mode input with pull up jtms pc4 debugger interface is active in serial wire mode bidirectional (push-pull output or floating input) controlled by debugger interface swdio
docid16252 rev 15 95/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose input/output 281 8.1.5 nbootmode nbootmode is a special alternate function of pa 5 that is active only during a pin reset (nrst) or a power-on-reset of the always-powered domain (por_hv). if nbootmode is asserted (pulled or driven low) when coming out of reset, the processor starts executing an embedded serial boot loader instead of its normal program. while in reset and during the subsequent power-on-reset startup delay (512 high-frequency rc oscillator periods), pa5 is au tomatically configured as an in put with a pull-up resistor. at the end of this time, the stm32w108 samples nbootmode: a high level selects normal startup, and a low level selects the boot lo ader. after nbootmode has been sampled, pa5 is configured as a floating input. the bo otmode bit in the gpio_dbgsr register captures the state of nbootmode so that so ftware may act on this signal if required. note: to avoid inadvertently asserting nbootmode, pa5's capacitive load should not exceed 252 pf. 8.1.6 gpio modes analog mode analog mode enables analog functions, and disconnects a pin from the digital input and output logic. only the following gpio pins have analog functions: ? pa4, pa5, pb5, pb6, pb7, and pc1 can be analog inputs to the adc. ? pb0 can be an external analog voltage referenc e input to the adc, or it can output the internal analog voltage reference from the adc. ? pc6 and pc7 can connect to an optional 32.768 khz crystal. note: when an external timing source is required , a 32.768 khz crystal is commonly connected to pc6 and pc7. alternatively, when pc7 is conf igured as a digital input, pc7 can accept a digital external clock input. when configured in analog mode: ? the output drivers are disabled. ? the internal pull-up and pull-down resistors are disabled. ? the schmitt trigger input is co nnected to a high logic level. ? reading gpiox_idr returns a constant 1. input mode input mode is used both for general purpose input and for on-chip peripheral inputs. input floating mode disables the internal pull-up and pull-down resistors, leaving the pin in a high- impedance state. input pull-up or pull-down mode enables either an internal pull-up or pull- down resistor based on the gpiox_odr register . setting a bit to 0 in gpiox_odr enables the pull-down and setting a bit to 1 enables the pull up. when configured in input mode: ? the output drivers are disabled. ? an internal pull-up or pull-down resistor may be activated depending on gpiox_crh/l and gpiox_odr. ? the schmitt trigger input is connected to the pin. ? reading gpiox_idr returns the input at the pin. ? the input is also available to on-chip peripherals.
general-purpose input/output stm32w108hb stm32w108cc stm32w108cb stm32w108cz 96/285 docid16252 rev 15 output mode output mode provides a general purpose output under direct software control. regardless of whether an output is configured as push -pull or open-drain, the gpio's bit in the gpiox_odr register controls the output. the gpiox_bsr and gpiox_brr registers can atomically set and clear bits within gpiox_o dr register. these set and clear registers simplify software using the output port because they eliminate the need to disable interrupts to perform an atomic read-modify-write operation of gpiox_odr. when configured in output mode: ? the output drivers are enabled and are cont rolled by the value wr itten to gpiox_odr: ? in open-drain mode: 0 activates the n-mo s current sink; 1 tri-states the pin. ? in push-pull mode: 0 activates the n-mos cu rrent sink; 1 activate s the p-mos current source. ? the internal pull-up and pull-down resistors are disabled. ? the schmitt trigger input is connected to the pin. ? reading gpiox_idr returns the input at the pin. ? reading gpiox_odr returns the last value written to the register. note: depending on configuration and usage, gpiox_odr and gpiox_idr may not have the same value. alternate output mode in this mode, the output is controlled by an on-chip peripheral instead of gpiox_odr and may be configured as either push-pull or open- drain. most peripherals require a particular output type - i 2 c requires an open-drain driver, for example - but since using a peripheral does not by itself configure a pin, the gpiox _crh/l registers must be configured properly for a peripheral's particular needs. as described in section 8.1.2: configuration on page 93 , when more than one peripheral can be the source of output data, registers in addition to gpiox_crh/l determine which to use. when configured in alternate output mode: ? the output drivers are enabled and are c ontrolled by the output of an on-chip peripheral: ? in open-drain mode: 0 activates the n-mo s current sink; 1 tri-states the pin. ? in push-pull mode: 0 activates the n-mos cu rrent sink; 1 activate s the p-mos current source. ? the internal pull-up and pull-down resistors are disabled. ? the schmitt trigger input is connected to the pin. ? reading gpiox_idr returns the input to the pin. note: depending on configuration and usage, gpiox_odr and gpiox_idr may not have the same value. alternate output spi sclk mode spi master mode sclk outputs, pb3 (sc1sclk ) or pa2 (sc2sclk), use a special output push-pull mode reserved for those signals. othe rwise this mode is identical to alternate output mode.
docid16252 rev 15 97/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose input/output 281 8.1.7 wake monitoring the pwr_wakepxr registers spec ify which gpios are monitore d to wake the processor. if a gpio's wake enable bit is set in pwr_ wakepxr, then a change in the logic value of that gpio causes the stm32w108 to wake from deep sleep. the logic values of all gpios are captured by hardware upon entering sleep. if any gpio's logic value changes while in sleep and that gpio's pwr_wakepxr bit is set, then the stm32w108 will wake from deep sleep. (there is no me chanism for selecting a specific rising-edge, falling-edge, or level on a gpio: any change in logic value triggers a wake event.) hardware records the fact that gpio activity caused a wake event, but not which specific gpio was responsible. instead, software should read the state of t he gpios on waking to determine the cause of the event. the register pwr_wakefil tr contains bits to enable di gital filtering of the external wakeup event sources: the gpio pins, sc1 activity, sc2 activity, and irqd. the digital filter operates by taking samples based on the (nominal) 10 khz lsi rc oscillator. if three samples in a row all have the same logic value, and this sampled logic value is different from the logic value seen upon entering slee p, the filter outputs a wakeup event. in order to use gpio pins to wake the stm32w108 from deep sleep, the gpio_sel bit in the extix_cr register must be se t. waking up from gpio activity does not work with pins configured for analog mode since the digital logic input is always set to 1 when in analog mode. refer to section 6: system modules on page 46 for information on the stm32w108's power management and sleep modes. 8.2 external interrupts the stm32w108 can use up to four external interrupt sources (irqa, irqb, irqc, and irqd), each with its own top level nvic interrupt vector. since these external interrupt sources connect to the standard gpio input path, an external interrupt pin may simultaneously be used by a peripheral devic e or even configured as an output. analog mode is the only gpio configuration that is not compatible with using a pin as an external interrupt. external interrupts have individual triggering and filtering options selected using the registers extia_tsr, extib_tsr, extic_tsr, and extid_tsr. the bit field intmod of the extix_tsr register enables irqx's second level interrupt and selects the triggering mode: 0 is disabled; 1 for rising edge; 2 for falling edge; 3 for both edges; 4 for active high level; 5 for active low level. the minimum width needed to latch an unfiltered external interrupt in both level- and edge-triggered mode is 80 ns. with the digital filter enabled (the filten bit in the extix_tsr register is set), the minimum width needed is 450 ns. the register exti_pr is the second-level inte rrupt flag register that indicates pending external interrupts. writing 1 to a bit in the exti_pr register clears the flag while writing 0 has no effect. if the interrupt is level-triggered, the flag bit is set again immediately after being cleared if its input is still in the active state. two of the four external interrupts, irqa an d irqb, have fixed pin assignments. the other two external interrupts, irqc and irqd, can use any gpio pin. the extic_cr and extid_cr registers specify the gpio pins assigned to irqc and irqd, respectively. table 16 shows how the extic_cr and extid_cr register values select the gpio pin used for the external interrupt.
general-purpose input/output stm32w108hb stm32w108cc stm32w108cb stm32w108cz 98/285 docid16252 rev 15 in some cases, it may be useful to assign irqc or irqd to an input also in use by a peripheral, for example to gene rate an interrupt fr om the slave select signal (nssel) in an spi slave mode interface. refer to section 12: interrupts on page 240 for further information regarding the stm32w108 interrupt system. 8.3 debug control and status two gpio registers are largely concerned with debugger functions. gpio_dbgcr can disable debugger operation, but has othe r miscellaneous control bits as well. gpio_dbgsr, a read-only register, return s status related to debugger activity (forcedbg and swen), as well a flag (b ootmode) indicating whether nbootmode was asserted at the last power-on or nrst-based reset. 8.4 gpio alternate functions table 17 lists the gpio alternate functions. table 16. irqc/d gpio selection extix_cr gpio extix_c r gpio extix_cr gpio 0 pa0 8 pb0 16 pc0 1 pa1 9 pb1 17 pc1 2 pa2 10 pb2 18 pc2 3 pa3 11 pb3 19 pc3 4 pa4 12 pb4 20 pc4 5 pa5 13 pb5 21 pc5 6 pa6 14 pb6 22 pc6 7 pa7 15 pb7 23 pc7 table 17. gpio signal assignments gpio analog alternate function input output current drive pa0 tim2_ch1 (1) , sc2mosi tim2_ch1 (1) , sc2mosi standard pa1 tim2_ch3 (1) , sc2miso, sc2sda tim2_ch3 (1) , sc2miso, sc2sda standard pa2 tim2_ch4 (1) , sc2sclk, sc2scl tim2_ch4 (1) , sc2sclk standard pa3 tim2_ch2 (1) , traceclk tim2_ch2 (1) , sc2nssel standard pa4 adc4 pti_en, tracedata2 standard
docid16252 rev 15 99/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose input/output 281 pa5 adc5 pti_data, tracedata3 nbootmode (2) standard pa6 tim1_ch3 tim1_ch3 high pa7 tim1_ch4, reg_en (3) tim1_ch4 high pb0 vref traceclk tim1clk, tim2msk, irqa standard pb1 tim2_ch1 (4) , sc1txd, sc1mosi, sc1miso, sc1sda tim2_ch1 (4) , sc1sda standard pb2 tim2_ch2 (4) , sc1sclk tim2_ch2 (4) , sc1miso, sc1mosi, sc1scl, sc1rxd standard pb3 tim2_ch3 (4) , sc1sclk tim2_ch3 (4) , sc1sclk, uart_cts standard pb4 tim2_ch4 (4) , uart_rts tim2_ch4 (4) , sc1nssel standard pb5 adc0 tim2clk, tim1msk standard pb6 adc1 tim1_ch1 tim1_ch1, irqb high pb7 adc2 tim1_ch2 tim1_ch2 high pc0 tracedata1 jrst (5) high pc1 adc3 tracedata0, swo standard pc2 jtdo (6) , swo standard pc3 jtdi (5) standard pc4 swdio (7) swdio (7) , jtms (5) standard pc5 tx_active standard pc6 osc32_in ntx_active standard pc7 osc32_out osc32_ext standard 1. default signal assignment (not remapped). 2. overrides during reset as an input with pull up. 3. overrides after reset as an open-drain output. 4. alternate signal assignment (remapped). 5. overrides in jtag mode as an input with pull up. 6. overrides in jtag mode as a push-pull output. 7. overrides in serial wire mode as either a push-pul l output, or a floating input, controlled by the debugger. table 17. gpio signal assignments (continued) gpio analog alternate function input output current drive
general-purpose input/output stm32w108hb stm32w108cc stm32w108cb stm32w108cz 100/285 docid16252 rev 15 8.5 general-purpose input/ output (gpio) registers 8.5.1 port x configurat ion register (low) ( gpiox_crl) address offset: 0xb000 (gpioa_crl), 0xb400 (gpiob_crl) and 0xb800 (gpioc_crl) reset value: 0x0000 4444 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 cnfmode3[3:0] cnfmode2[3:0] cnfmode1[3:0] cnfmode0[3:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:12 cnfmode3[3:0]: gp io configuration control 0x0: analog, input or output (gpiox_idr always reads 1) 0x1: output, push-pull (gpi ox_odr controls the output) 0x4: input, floating 0x5: output, open-drain (gpi ox_odr controls the output) 0x8: input, pulled up or down (select ed by gpiox_odr: 0 = pull-down, 1 = pull-up) 0x9: alternate output, push-pull (peripheral controls the output) 0xb: alternate output spi sclk, push-pu ll (only for spi master mode sclk) 0xd: alternate output, open-drain (peripheral controls the output) bits 11:8 cnfmode2[3: 0]: gpio configurat ion control and mode see cnfmode3 above bits 7:4 cnfmode1[3: 0]: gpio configurat ion control and mode see cnfmode3 above bits 3:0 cnfmode0[3: 0]: gpio configurat ion control and mode see cnfmode3 above
docid16252 rev 15 101/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose input/output 281 8.5.2 port x configuration re gister (high) (gpiox_crh) address offset: 0xb004 (gpioa_crh), 0xb404 (gpiob_crh) and 0xb804 (gpioc_crh) reset value: 0x0000 4444 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 cnfmode7[3:0] cnfmode6[3:0] cnfmode5[3:0] cnfmode4[3:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:12 cnfmode7[3:0]: gpio configuration control 0x0: analog, input or output (gpiox_idr always reads 1) 0x1: output, push-pull (gpiox_odr controls the output) 0x4: input, floating 0x5: output, open-drain (gpi ox_odr controls the output) 0x8: input, pulled up or down (selected by gpiox_odr: 0 = pull-down, 1 = pull-up) 0x9: alternate output, push-pull ( peripheral controls the output) 0xb: alternate output spi sclk, push-p ull (only for spi master mode sclk) 0xd: alternate output, open-drain (peripheral controls the output) bits 11:8 cnfmode6[3:0]: gpio configuration control and mode see cnfmode7 above bits 7:4 cnfmode5[3:0]: gpio configuration control and mode see cnfmode7 above bits 3:0 cnfmode4[3:0]: gpio configuration control and mode see cnfmode7 above
general-purpose input/output stm32w108hb stm32w108cc stm32w108cb stm32w108cz 102/285 docid16252 rev 15 8.5.3 port x input data register (gpiox_idr) address offset: 0xb008 (gpioa_idr), 0x b408 (gpiob_idr) and 0xb808 (gpioc_idr) reset value: 0x0000 0000 8.5.4 port x output data register (gpiox_odr) address offset: 0xb00c (gpioa_odr), 0xb40c (gpiob_odr) and 0xb80c (gpioc_odr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved idry[7:0] rw rw rw rw rw rw rw rw bits 31:8 reserved, must be kept at reset value bits 7:0 idry[7:0]: port input data (y = 0...7) 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved odry[7:0] rw rw rw rw rw rw rw rw bits 31:8 reserved, must be kept at reset value bits 7:0 odry[7:0]: port output data (y = 0...7)
docid16252 rev 15 103/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose input/output 281 8.5.5 port x output set register (gpiox_bsr) address offset: 0xb010 (gpioa _bsr), 0xb410 (gpiob_bsr) and 0xb810 (gpioc_bsr) reset value: 0x0000 0000 8.5.6 port x output clear register (gpiox_brr) address offset: 0xb014 (gpioa_brr), 0xb414 (gpiob_brr) and 0xb814 (gpioc_brr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved bsy[7:0] rw rw rw rw rw rw rw rw bits 31:8 reserved, must be kept at reset value bits 7:0 bsy[7:0]: port x set bit y (y = 0...7) 0: no action on the corresponding odrx bit 1: reset the corresponding odrx bit 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved bry[7:0] ww wwwwww bits 31:8 reserved, must be kept at reset value bits 7:0 bry[7:0]: port x reset bit y (y = 0...7) these bits are write-only and c an only be accessed in word mode. 0: no action on the corresponding odrx bit 1: reset the corresponding odrx bit
general-purpose input/output stm32w108hb stm32w108cc stm32w108cb stm32w108cz 104/285 docid16252 rev 15 8.5.7 external interrupt pending register (exti_pr) address offset: 0xa814 reset value: 0x0000 0000 8.5.8 external interrupt x trigge r selection register (extix_tsr) address offset: 0xa860 (extia _tsr), 0xa864 (extib_tsr), 0xa868 (extic_tsr) a nd 0xa86c (extid_tsr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved irqdp irqcp irqbp irqap rw rw rw rw bits 31:4 reserved, must be kept at reset value bit 3 irqdp: exti d pending flag bit 2 irqcp: exti c pending flag bit 1 irqbp: exti b pending flag bit 0 irqap: exti a pending flag 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved filte n intmod[2:0] reserved rw rw rw rw bits 31:9 reserved, must be kept at reset value bit 8 filten: set this bit to enable digital filtering on irqx. bits 7:5 intmod[2:0]: extix triggering mode 0x0: disabled 0x1: rising edge triggered 0x2: falling edge triggered 0x3: rising and falling edge triggered. 0x4: active high level triggered 0x5: active low level triggered 0x6, 0x7: reserved, must be kept at reset value bits 4:0 reserved, must be kept at reset value
docid16252 rev 15 105/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose input/output 281 8.5.9 external interrupt x conf iguration register (extix_cr) address offset: 0xbc14 (extic_cr) and 0xbc18 (extid_cr) reset value: 0x0000 000f (extic_cr) and 0x0000 0010 (extid_cr) 8.5.10 pc trace or debug sel ect register (gpio_pctracecr) address offset: 0x4000 4028 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved gpio_sel[4:0] rw rw rw rw rw bits 31:5 reserved, must be kept at reset value bits 4:0 gpio_sel[4:0]: pin assigned to extix 0x00: pa0 0x01: pa1 0x02: pa2 0x03: pa3 0x04: pa4 0x05: pa5 0x06: pa6 0x07: pa7 0x08: pb0 0x09: pb1 0x0a: pb2 0x0b: pb3 0x0c: pb4 0x0d: pb5 0x0e: pb6 0x0f: pb7 0x10: pc0 0x11: pc1 0x12: pc2 0x13: pc3 0x14: pc4 0x15: pc5 0x16: pc6 0x17: pc7 0x18 - 0x1f: reserved, must be kept at reset value 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved sel rws bits 31:1 reserved, must be kept at reset value bit 0 sel: channel encoding 1: pc trace 0: bb debug
general-purpose input/output stm32w108hb stm32w108cc stm32w108cb stm32w108cz 106/285 docid16252 rev 15 8.5.11 gpio debug configurat ion register (gpio_dbgcr) address offset: 0xbc00 reset value: 0x0000 0010 8.5.12 gpio debug status register (gpio_dbgsr) address offset: 0xbc04 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved dbgdis extr egen pad drive reserved rw rw rw bit 31:6 reserved, must be kept at reset value bit 5 dbgdis: disable debug interface ov erride of normal gpio configuration 0: permits debug interface to be active. 1: disables debug interface (if it is not already active). bit 4 extregen: disable reg_en override of pa7's normal gpio configuration 0: enable override 1: disable override bit 3 paddrive: global pad drive strength 0: disables the pad drive strength 1: enables the pad drive strength bit 2:0 reserved, must be kept at reset value 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved boot mode reserved force dbg swen rrr bit 31:4 reserved, must be kept at reset value bit 3 bootmode: the state of the nbootmode signal sampled at the end of reset 0: nbootmode was not asserted (it read high) 1: nbootmode was asserted (it read low)
docid16252 rev 15 107/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose input/output 281 8.5.13 general-purpose input/ output (gpio) register map table 18 gives the gpio register map and reset values. bit 2 reserved, must be kept at reset value bit 1 forcedbg: status of debugger interface 0: debugger interface not forced active 1: debugger interface forced active by debugger cable bit 0 swen: status of serial wire interface 0: not enabled by swj-dp 1: enabled by swj-dp table 18. gpio register map and reset values offset gpio a/b/c/d register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0x00 gpioa_crl re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cnfmode3 [3:0] cnfmode2 [3:0] cnfmode1 [3:0] cnfmode0 [3:0] reset value 0100010001000100 0x04 gpiox_crh re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cnfmode7 [3:0] cnfmode6 [3:0] cnfmode5 [3:0] cnfmode4 [3:0] reset value 0100010001000100 0x08 gpiox_idr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . idr7 idr6 idr5 idr4 idr3 idr2 idr1 idr0 reset value 00000000 0x0c gpiox_odr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . odr7 odr6 odr5 odr4 odr3 odr2 odr1 odr0 reset value 00000000 0x10 gpiox_bsr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . bs7 bs6 bs5 bs4 bs3 bs2 bs1 bs0 reset value 00000000 0x14 gpiox_brr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . br7 br6 br5 br4 br3 br2 br1 br0 reset value 00000000 0xa814 exti_pr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . irqdp irqcp irqbp irqap reset value 0000 0xa818- 0xa85c re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . 0xa860 extia_tsr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . filten int mode [3:0] re s . re s . re s . re s . re s . reset value 0000 0xa864 extib_tsr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . filten int mode [3:0] re s . re s . re s . re s . re s . reset value 0000 0xa868 extic_tsr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . filten int mode [3:0] re s . re s . re s . re s . re s . reset value 0000
general-purpose input/output stm32w108hb stm32w108cc stm32w108cb stm32w108cz 108/285 docid16252 rev 15 refer to figure 4: stm32w108xb memory mapping, figure 5: stm32w108cc and stm32w108cz memory mapping, and table 3: stm32w108xx peripheral register boundary addresses for the register boundary addresses of the peripherals available in all stm32w108xx devices. 0xa86c extid_tsr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . filten int mode [3:0] re s . re s . re s . re s . re s . reset value 0000 0xa870- 0xbc10 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . 0xbc14 extic_cr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . gpio_sel [4:0] reset value 01111 0xbc18 extid_cr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . gpio_sel [4:0] reset value 01111 0x4028 gpio_pctrace cr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . sel reset value 0 0x402c- 0xbbfc re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . 0xbc00 gpio_dbgcr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . dbgdis extregen paddrive re s . re s . re s . reset value 010 0xbc04 gpio_dbgsr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . bootmode re s . forcedbg swen reset value 000 table 18. gpio register map and reset values (continued) offset gpio a/b/c/d register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
docid16252 rev 15 109/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9 serial interfaces 9.1 functional description the stm32w108 has two serial controllers, sc 1 and sc2, which provide several options for full-duplex synchronous and asynchronous serial communications. ? spi (serial peripheral interface), master or slave ? i 2 c (inter-integrated circuit), master only ? uart (universal asynchronous receiver/transmitter), sc1 only ? receive and transmit fifos and dma channels, spi and uart modes receive and transmit fifos allow faster data speeds using byte-at-a-time interrupts. for the highest spi and uart speeds, dedicated receive and transmit dma channels reduce cpu loading and extend the allowable time to service a serial contro ller interrupt. polled operation is also possible using direct access to the serial data registers. figure 10 shows the components of the serial controllers. note: the notation scx means that either sc1 or sc2 may be substituted to form the name of a specific register or field within a register.
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 110/285 docid16252 rev 15 figure 10. serial controller block diagram 9.2 configuration before using a serial controller, it should be configured and in itialized as follows: 1. set up the parameters specific to the oper ating mode (master/slave for spi, baud rate for uart, etc.). 2. configure the gpio pins used by the serial controller as shown in table 19 and table 20 . section 8.1.2: configuration on page 93 shows how to configure gpio pins."if using dma, set up the dma and buffers. this is described fully in section 9.12: serial controller: direct memory access (dma) registers on page 144 . 3. if using interrupts, select edge- or level-triggered interrupts with the scx_icr register, enable the desired second-level interrupt sour ces in the scx_ier register, and finally enable the top-level scx interrupt in the nvic. 4. write the serial interface operating mode - spi, i 2 c, or uart - to the scx_cr register. sc1_uartsr scx_spisr scx_spicr scx_i2csr scx_i2ccr1 scx_i2ccr2 scx_crr1/scx_crr2 sc1_uartbrr1/sc1_uartbrr2 baud generator clock generator uart controller i 2 c master controller scx_dr spi master controller uart spi i 2 c off scx_cr 0 1 2 3 nrts ncts sclk mosi miso sda txd rxd rx-fifo tx-fifo scx_dmasr scx_dmacr scx_dmarxerrar/scx_dmarxerrbr dma controller scl scx_isr scx_ier sc1_uartcr scx interrupt scx tx dma channel scx rx dma channel spi slave controller nssel scx_dmarxcntsavedr sc1 only scx_dmatxcntr scx_dmarxcntar/ scx_dmarxcntbr scx_dmarxbegaddar/ scx_dmarxbegaddbr/ scx_dmatxbegaddar/ scx_dmatxbegaddbr scx_dmarxendaddar/ scx_dmatxendaddar/ scx_dmarxendaddbr/ scx_dmatxendaddbr
docid16252 rev 15 111/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.3 spi master mode the spi master controller has the following features: ? full duplex operation ? programmable clock frequency (6 mhz max. for stm32w108xb and 12 mhz max for stm32w108cc and stm32w108cz) ? programmable clock polarity and phase ? selectable data shift direct ion (either lsb or msb first) ? receive and transmit fifos ? receive and transmit dma channels the spi master controller uses the three signals: ? mosi (master out, slave in) - ou tputs serial data from the master ? miso (master in, slave out) - inputs serial data from a slave ? sclk (serial clock) - outputs the se rial clock used by mosi and miso the gpio pins used for these signals are shown in table 21 . additional outputs may be needed to drive the nssel signals on slave devices. table 19. sc1 gpio usage and configuration interface pb1 pb2 pb3 pb4 spi - master sc1mosi alternate output (push-pull) sc1miso input sc1sclk alternate output (push-pull); special sclk mode (not used) spi - slave sc1miso alternate output (push-pull) sc1mosi input sc1sclk input sc1nssel input i 2 c - master sc1sda alternate output (open-drain) sc1scl alternate output (open-drain) (not used) (not used) uart txd alternate output (push-pull) rxd input ncts input (1) 1. used if rts/cts hardware flow control is enabled. nrts alternate output (push-pull) (1) table 20. sc2 gpio usage and configuration interface pa0 pa1 pa2 pa3 spi - master sc2mosi alternate output (push-pull) sc2miso input sc2sclk alternate output (push-pull), special sclk mode (not used) spi - slave sc2mosi alternate output (push-pull) sc2miso input sc2sclk input sc2nssel input i 2 c - master (not used) sc2sda alternate output (open-drain) sc2scl alternate output (open-drain) (not used)
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 112/285 docid16252 rev 15 9.3.1 setup and configuration both serial controllers, sc1 and sc2, supp ort spi master mode. spi master mode is enabled by the following register settings: ? the serial controller mode r egister (scx_cr) is ?2?. ? the mstr bit in the spi configurat ion register (scx_spicr) is ?1?. ? the ack bit in the i 2 c control register (scx_i2ccr2) is ?1?. the spi serial clock (sclk) is produced by a programmable clock generator. the serial clock is produced by dividing down 12 mhz according to this equation: exp is the value written to th e scx_crr2 register and lin is the value written to the scx_crr1 register. the spi ma ster mode clock may not ex ceed 6 mbps, so exp and lin cannot both be zero. the spi master controller supports various frame formats depending upon the clock polarity (cpol), clock phase (cpha), and direction of data (lsbfirst) (see spi master mode formats on page 113 ). the bits cpol, cpha, and lsbfirst are defined within the scx_spicr register. table 21. spi master gpio usage parameter mosi miso sclk direction output input output gpio configuration alternate output (push-pull) input alternate output (push-pull) special sclk mode sc1 pin pb1 pb2 pb3 sc2 pin pa0 pa1 pa2 rate 12mhz lin 1 + () x2 exp ----------------- -------------- ---------- =
docid16252 rev 15 113/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.3.2 operation characters transmitted and received by the spi master controller are buffered in transmit and receive fifos that are both 4 entries deep. when software writes a character to the scx_dr register, the character is pushed onto the transmit fi fo. similarly, when software reads from the scx_dr register, the character returned is pulled from the receive fifo. if the transmit and receive dma channels are used, they also write to and read from the transmit and receive fifos. when the transmit fifo and the serializer are bo th empty, writing a character to the transmit fifo clears the idle bit in the scx_spisr re gister. this indicates that some characters have not yet been transmitted. if characters are written to the transmit fifo until it is full, the txe bit in the scx_spisr register is cleared. shifting out a character to the mosi pin sets the txe bit in the scx_spisr register. when the transmit fifo empties and the last character has been shifted ou t, the idle bit in the scx_spisr register is set. table 22. spi master mode formats scx_spicr frame formats mstr lsb first cpha cpol 1000 1001 1010 1011 1 1 - - same as above except data is sent lsb first instead of msb first. sclk out mosi out miso in rx[7] tx[7] rx[6] tx [6] rx[5] tx[5] rx[4] tx[4] rx[3] tx [3] rx[2] tx[2] rx[1] tx[1] rx[0] tx[0] mosi out miso in rx[7] tx[7] rx[6] tx [6] rx[5] tx[5] rx[4] tx[4] rx[3] tx [3] rx[2] tx[2] rx[1] tx[1] rx[0] tx [0] sclk out mosi out miso in rx[7] tx [7] rx[6] tx[6] rx[5] tx[5] rx[4] tx [4] rx[3] tx[3] rx[2] tx[2] rx[1] tx [1] rx[0] tx [0] sclk out mosi out miso in rx[7] tx[7] rx[6] tx [6] rx[5] tx[5] rx[4] tx[4] rx[3] tx [3] rx[2] tx[2] rx[1] tx[1] rx[0] tx [0] sclk out
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 114/285 docid16252 rev 15 characters received are stored in the receive fifo. receiving characters sets the rxne bit in the scx_spisr register, indicating that c haracters can be read from the receive fifo. characters received while the receive fifo is full are dropped, and the ovf bit in the scx_spisr register is set. the receive fifo hardware generates the ovr, but the dma register will not indicate the erro r condition until the receive fi fo is drained. once the dma marks a receive error, two conditions will clear the error indication: se tting the appropriate txrst/rxrst bit in the scx_dmacr register, or loading the appropriate dma buffer after it has unloaded. to receive a character, you must transmit a char acter. if a long stream of receive characters is expected, a long sequence of dummy transmit characters must be generated. to avoid software or transmit dma init iating these transfers and consuming unnecessary bandwidth, the spi serializer can be instructed to retransmit the last transmitted character or to transmit a busy token (0xff), which is determined by th e rpten bit in the scx_spicr register. this functionality can only be enabled or disabled when the transmit fifo is empty and the transmit serializer is idle, indicated by a cleared idle bit in the scx_spisr register. every time an automatic character transmission starts, a transmit underrun is detected as there is no data in transmit fifo, and the udr bit in the sc 2_isr register is set. after automatic character transmission is disabled, no more new characters are received. the receive fifo holds char acters just received. note: the receive dma complete event does not always mean the receive fifo is empty. the dma channels section describes how to configure and use the serial receive and transmit dma channels. 9.3.3 interrupts spi master controller second level interrupts are generated by the following events: ? transmit fifo empty and last character shif ted out (depending on scx_icr, either the 0 to 1 transition or the high level of idle) ? transmit fifo changed from full to not full (depending on scx_icr, either the 0 to 1 transition or the high level of txe) ? receive fifo changed from empty to not em pty (depending on scx_icr, either the 0 to 1 transition or the high level of rxne) ? transmit dma buffer a/b complete (1 to 0 transition of txaack/txback) ? receive dma buffer a/b co mplete (1 to 0 transi tion of rxaack/rxback) ? received and lost characte r while receive fifo was full (receive overrun error) ? transmitted character while transmit fifo was empty (transmit underrun error) to enable cpu interrupts, set the desired interrupt bits in the scx_ier register.
docid16252 rev 15 115/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.4 spi slave mode both sc1 and sc2 spi controllers include a spi slave controller with these features: ? full duplex operation ? up to 5 mbps data transfer rate ? programmable clock polar ity and clock phase ? selectable data shift direct ion (either lsb or msb first) ? slave select input the spi slave controller uses four signals: ? mosi (master out, slave in) - in puts serial data from the master ? miso (master in, slave out) - ou tputs serial data to the master ? sclk (serial clock) - clocks data transfers on mosi and miso ? nssel (slave select) - enables seri al communication with the slave the gpio pins that can be assigned to these signals are shown in table 23 . 9.4.1 setup and configuration both serial controllers, sc1 and sc2, suppor t spi slave mode. spi slave mode is enabled by the following register settings: ? the serial controller mode register, scx_cr, is ?2?. ? the mstr bit in the spi configuration register, scx_spicr, is ?0?. the spi slave controller receives its clock from an external spi master device and supports rates up to 5 mbps. the spi slave controller supports various fr ame formats depending upon the clock polarity (cpol), clock phase (cpha), and direction of data (lsbfirst). the cpol, cpha, and lsbfirst bits are defined wit hin the scx_spicr register. table 23. spi slave gpio usage parameter mosi miso sclk nssel direction input output input input gpio configuration input alternate output (push-pull) input input sc1 pin pb2 pb1 pb3 pb4 sc2 pin pa0 pa1 pa2 pa3
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 116/285 docid16252 rev 15 9.4.2 operation when the slave select (nssel) signal is asserted by the master, spi transmit data is driven to the output pin miso, and spi data is rece ived from the input pin mosi. the nssel pin has to be asserted to enable the transmit seria lizer to drive data to the output signal miso. a falling edge on nssel resets the spi slave shift registers. characters transmitted and received by the spi slave controller are buffered in the transmit and receive fifos that are both 4 entries deep. when software writes a character to the scx_dr register, it is pushed onto the transm it fifo. similarly, when software reads from the scx_dr register, the character returned is pulled from the receive fifo. if the transmit and receive dma channels are used, the dma channels also write to and read from the transmit and receive fifos. table 24. spi slave mode formats scx_spicr frame format mstr lsb first cpha cpol 0000 0001 0010 0011 0 1 - - same as above except lsb first instead of msb first. tx[7] rx[7] tx[6] rx[6] tx [5] rx[5] tx[4] rx[4] tx[3] rx[3] tx[2] rx[2] tx [1] rx[1] tx[0] rx[0] nssel sclk in mosi in miso out tx[7] rx[7] tx[6] rx[6] tx [5] rx[5] tx[4] rx[4] tx[3] rx[3] tx [2] rx[2] tx[1] rx[1] tx[0] rx[0] sclk in mosi in miso out tx[7] rx[7] tx[6] rx[6] tx [5] rx[5] tx[4] rx[4] tx[3] rx[3] tx [2] rx[2] tx[1] rx[1] tx[0] rx[0] nssel sclk in mosi in miso out tx[ 7] rx[7] tx[6] rx[6] tx [5] rx[5] tx[4] rx[4] tx[3] rx[3] tx [2] rx[2] tx[1] rx[1] tx[0] rx[0] nssel mosi in miso out sclk in
docid16252 rev 15 117/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 characters received are stored in the receive fifo. receiving characters sets the rxne bit in the scx_spisr register, to indicate that characters can be read from the receive fifo. characters received while the receive fifo is full are dropped, and the ovf bit in the scx_spisr register is set. the receive fifo hardware generates the ovr interrupt, but the dma register will not indicate the error conditi on until the receive fi fo is drained. once the dma marks a receive error, two condition s will clear the error i ndication: setting the appropriate txrst/rxrst bit in the scx_dm acr register, or loading the appropriate dma buffer after it has unloaded. receiving a character causes the serial transmis sion of a character pulled from the transmit fifo. when the transmit fifo is empty, a transmit underrun is detected (no data in transmit fifo) and the udr bit in the scx_isr register is set. because no character is available for serialization, the spi serializer retransmits the last transmitted character or a busy token (0xff), determined by the rpten bit in the scx_spicr register. when the transmit fifo and the serializer are bo th empty, writing a character to the transmit fifo clears the idle bit in the scx_spisr register. this indicates that not all characters have been transmitted. if characters are written to the transmit fifo unt il it is full, the txe bit in the scx_spisr register is cleared. shifting out a trans mit character to the miso pin causes the txe bit in the scx_spisr register to get set. when the transmit fifo empties and the last character has been shifted out, th e idle bit in the scx_spisr register is set. the spi slave controller must guar antee that there is time to move new transmit data from the transmit fifo into the hard ware serializer. to provide sufficient time, the spi slave controller inserts a byte of padding at the start of every new string of transmit data. after slave select asserts and the rxne bit in the scx_spisr register gets set at least once, the following operation holds true until slave sele ct deasserts. whenever the transmit fifo is empty and data is placed into the transmit fifo, either manually or through dma, the spi hardware inserts a byte of padding onto the fr ont of the transmission as if this byte was placed there by software. the value of the byte of padding that is inserted is selected by the rpten bit in the scx_spicr register. 9.4.3 dma the dma channels section describes how to configure and use the serial receive and transmit dma channels. when using the receive dma chann el and nssel transitions to th e high (deasser ted) state, the active buffer's receive dma count r egister (scx_dmarxcntar/scx_dmarxcntbr) is saved in the scx_dmarxcntsavedr r egister. scx_dmarxcntsavedr is only written the first time nssel goes high after a buffer ha s been loaded. su bsequent rising edges set a status bit but are otherwise igno red. the 3-bit field nsss in the scx_dmasr register records what, if anything, was sa ved to the scx_dmarxcntsavedr register, and whether or not another risi ng edge occurred on nssel.
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 118/285 docid16252 rev 15 9.4.4 interrupts spi slave controller second level interrupts are generated on the following events: ? transmit fifo empty and last character shif ted out (depending on scx_icr, either the 0 to 1 transition or the high level of idle) ? transmit fifo changed from full to not full (depending on scx_icr, either the 0 to 1 transition or the high level of txe) ? receive fifo changed from empty to not em pty (depending on scx_icr, either the 0 to 1 transition or the high level of rxne) ? transmit dma buffer a/b complete (1 to 0 transition of txaack/txback) ? receive dma buffer a/b co mplete (1 to 0 transi tion of rxaack/rxback) ? received and lost characte r while receive fifo was full (receive overrun error) ? transmitted character while transmit fifo was empty (transmit underrun error) to enable cpu interrupts, set desired interrupt bits in the second level scx_ier register. 9.5 inter-integrated circuit interfaces (i 2 c) both stm32w108 serial controllers sc1 and sc2 include an inter-integrated circuit interface (i 2 c) master controller with the following features: ? uses only two bidirectional gpio pins ? programmable clock frequency (up to 400 khz) ? supports both 7-bit and 10-bit addressing ? compatible with philips' i 2 c-bus slave devices the i 2 c master controller uses just two signals: ? sda (serial data) - bidirectional serial data ? scl (serial clock) - bidirectional serial clock table 25 lists the gpio pins used by the sc1 and sc2 i 2 c master controllers. because the pins are configured as open-drain outputs , they require external pull-up resistors. table 25. i 2 c master gpio usage parameter sda scl direction input / output input / output gpio configuration alternate output (open drain) alternate output (open drain) sc1 pin pb1 pb2 sc2 pin pa1 pa2
docid16252 rev 15 119/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.5.1 setup and configuration the i 2 c controller is enabled by writing 3 to the scx_cr register. the i 2 c controller operates only in master mode and supports both standard (100 kbps) and fast (400 kbps) i 2 c modes. address arbitration is not implement ed, so multiple master applications are not supported. the i 2 c master controller's serial clock (scl ) is produced by a programmable clock generator. scl is produced by dividing down 12 mhz according to this equation: exp is the value written to th e scx_crr2 register and lin is the value written to the scx_crr1 register. i2c clock rate programming on page 119 shows the rate settings for standard-mode i 2 c (100 kbps) and fast-mode i 2 c (400 kbps) operation. note: at 400 kbps, the philips i 2 c bus specification requires the minimum low period of scl to be 1.3 s, but on the stm32w108 it is 1.25 s. if a slave device requires strict compliance with scl timing, the clock rate must be lowered to 375 kbps. 9.5.2 constructing frames the i 2 c master controller supports generating va rious frame segments by means of the start, stop, bte, and bre bits in the scx_i2ccr1 registers. figure 27 summarizes these frames. table 26. i 2 c clock rate programming clock rate scx_crr1 scx_crr2 100 kbps 14 3 375 kbps 15 1 400 kbps 14 1 rate 12mhz lin 1 + () x2 exp ----------------- -------------- ---------- =
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 120/285 docid16252 rev 15 table 27. i 2 c master frame segments scx_12ccr1 frame segments start bte bre stop 1000 0100 0010 0001 0 0 0 0 no pending frame segment 1 - - 1 1 1 - - - 1 1 - - - 1 1 illegal twi re-start segment - after transmit or frame with nack sda out sda outslave scl outslave scl out twi start segment sda out sda outslave scl outslave scl out scl out tx[7]tx[6]tx[5]tx[4]tx[3]tx[2]tx[1]tx[0] sda out sda outslave scl outslave (n)ack twi transmit segment - after (re-)start frame scl out tx[7]tx[6]tx[5]tx[4]tx[3]tx[2]tx[1]tx[0] sda out sda outslave scl outslave (n)ack twi transmit segment ? after transmit with ack scl out rx[7]rx[6]rx[5]rx[4]rx[3]rx[2]rx[1]rx[0] sda out sda outslave scl outslave (n)ack twi receive segment ? transmit with ack scl out rx[7]rx[6]rx[5]rx[4]rx[3]rx[2]rx[1]rx[0] sda out sda outslave scl outslave (n)ack twi receive segment - after receive with ack twi stop segment - after frame with nack or stop sda out sda outslave scl outslave scl out
docid16252 rev 15 121/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 full i 2 c frames have to be constructed by software from individual i 2 c segments. all necessary segment transitions are shown in figure 11 . ack or nack generation of an i 2 c receive frame segment is determined with the ack bit in the scx_i2ccr2 register. figure 11. i 2 c segment transitions generation of a 7-bit address is accomplished with one transmit segment. the upper 7 bits of the transmitted character contain the 7-bit address. the remaining lower bit contains the command type ("read" or "write"). generation of a 10-bit address is accomplishe d with two transmit segments. the upper 5 bits of the first transmit character must be set to 0x1e. the next 2 bits are for the 2 most significant bits of the 10-bit address. the remaining lower bit contains the command type ("read" or "write"). the second transmit segment is for the remaining 8 bits of the 10-bit address. transmitted and received characters are accessed through the scx_dr register. to initiate (re)start and stop segments, set the start or stop bit in the scx_i2ccr1 register, then wait until the bit is clear. alte rnatively, the cmdfin bit in the scx_i2csr can be used for waiting. to initiate a transmit segment, write the data to the scx_dr data register, then set the bte bit in the scx_i2ccr1 register, and finally wait until the bit is clear. alternatively the btf bit in the scx_i2csr register can be used for waiting. to initiate a receive segment, set the bre bit in the scx_i2ccr1 regist er, wait until it is clear, and then read from the scx_dr regist er. alternatively, the brf bit in the scx_ register can be used for waiting. now the nack bit in the scx_i2csr register indicates if a nack or ack was re ceived from an i 2 c slave device. receive segment with nack receive segment with ack idle star t segment stop segment tran smit segment received ack ? no yes
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 122/285 docid16252 rev 15 9.5.3 interrupts i 2 c master controller interrupts are generated on the following events: ? bus command (start/stop) completed (0 to 1 transition of cmdfin) ? character transmitted and slave device responded with nack ? character transmitted (0 to 1 transition of btf) ? character received (0 to 1 transition of brf) ? received and lost characte r while receive fifo was full (receive overrun error) ? transmitted character while transmit fifo was empty (transmit underrun error) to enable cpu interrupts, set the desired interrupt bits in the second level scx_ier register. 9.6 universal asynchronous receiver/transmitter (uart) the sc1 uart is enabled by writing 1 to sc1_cr. the sc2 serial controller does not include uart functions. the uart supports the following features: ? flexible baud rate clock (300 bps to 921.6 bps) ? data bits (7 or 8) ? parity bits (none, odd, or even) ? stop bits (1 or 2) ? false start bit and noise filtering ? receive and transmit fifos ? optional rts/cts flow control ? receive and transmit dma channels the uart uses two signals to transmit and receive serial data: ? txd (transmitted data) - serial data received by the stm32w108 ? rxd (received data) - serial data sent by the stm32w108 if rts/cts flow control is enabled, these two signals are also used: ? nrts (request to send) - indicates the stm32w108 is able to receive data rxd ? ncts (clear to send) - inhibits sending data from the stm32w108 if not asserted the gpio pins assigned to these signals are shown in table 28 . table 28. uart gpio usage parameter txd rxd ncts (1) 1. only used if rts/cts hardware flow control is enabled. nrts (1) direction output input input output gpio configuration alternate output (push-pull) input input alternate output (push-pull) sc1 pin pb1 pb2 pb3 pb4
docid16252 rev 15 123/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.6.1 setup and configuration the uart baud rate clock is produced by a pr ogrammable baud generator starting from the 24 hz clock: the integer portion of the divisor, n, is wr itten to the sc1_uartbrr1 register and the fractional part, f, to the sc1_uartbrr2 register. table 29 shows the values used to generate some common baud rates and their associated clock frequency error. the uart requires an internal clock that is at least eight times the bau d rate clock, so the minimum allowable setting for sc1_uartbrr1 is ?8?. note: the uart may receive corrupt bytes if the interbyte gap is long or there is a baud rate mismatch between receive and transmit. the uart may detect a parity and/or framing error on the corrupt byte, but there will not necessarily be any error detected. as a result, the device should be operated in systems where the other side of the communication link also uses a crystal as its timing reference, and b aud rates should be selected to minimize the baud rate mismatch to the crystal tolerance. uart protocols should contain some form of error checking (e.g. crc) at the packet level to detect, and retry in the event of errors. the uart character frame format is determined by three bits in the sc1_uartcr register: ? stop selects the number of stop bits in tr ansmitted characters. (only one stop bit is ever required in received characters.) if this bit is clear, characters are transmitted with one stop bit; if set, characters are transmitted with two stop bits. ? pce controls whether or not received and transmitted characters include a parity bit. if pce is clear, characters do not contain a pa rity bit, otherwise, characters do contain a parity bit. ? ps specifies whether transmitted and received parity bits contain odd or even parity. if this bit is clear, the parity bit is even, and if set, the parity bit is odd. even parity is the exclusive-or of all of the data bits, and odd pa rity is the inverse of the even parity value. ps has no effect if pce is clear. table 29. uart baud rate divisors for common baud rates baud rate (bits/sec) sc1_uartbrr1 sc1_uartbrr2 baud rate error (%) 300 40000 0 0 2400 5000 0 0 4800 2500 0 0 9600 1250 0 0 19200 625 0 0 38400 312 1 0 57600 208 1 - 0.08 115200 104 0 + 0.16 230400 52 0 + 0.16 460800 26 0 + 0.16 921600 13 0 + 0.16 f n mhz baud + = 2 24
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 124/285 docid16252 rev 15 a uart character frame contains, in sequence: ? the start bit ? the least significant data bit ? the remaining data bits ? if parity is enabled, the parity bit ? the stop bit, or bits, if 2 stop bits are selected. figure 12 shows the uart character frame format, with optional bits indicated. depending on the options chosen for the character frame, the length of a character frame ranges from 9 to 12 bit times. note that asynchronous serial data may have arbitrarily long idle periods between characters. when idle, serial data (txd or rxd) is held in the high state. serial data transitions to the low state in the start bit at the beginning of a character frame. figure 12. uart character frame format 9.6.2 fifos characters transmitted and received by the uart are buffered in the transmit and receive fifos that are both 4 entries deep (see figure 13 ). when software writes a character to the sc1_dr register, it is pushed onto the transm it fifo. similarly, wh en software reads from the sc1_dr register, the character returned is pulled from the receive fifo. if the transmit and receive dma channels are used, the dma channels also write to and read from the transmit and receive fifos. figure 13. uart fifos idle time start bit data bit 0 data bit 1 data bit 2 data bit 3 data bit 4 data bit 5 data bit 6 data bit 7 parity bit stop bit stop bit next start bit or idletime uart character fr am e for mat (optional sections are in italics ) txd or rxd receive shift register sc1_data (read) transmit shift register sc1_data (write) rxd txd parity/frame errors sc1_uartstat receive fif o transmit fifo cpu and dma channel access sc1_dr(read) sc1_dr(write) ms30519v1 sc1_uartsr
docid16252 rev 15 125/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.6.3 rts/cts flow control rts/cts flow control, also called hardware flow control, uses two signals (nrts and ncts) in addition to received and transmitted data (see figure 14 ). flow control is used by a data receiver to prevent buffer overflow, by signaling an external device when it is and is not allowed to transmit. figure 14. rts/cts flow control connections the uart rts/cts flow control options are se lected by the hfce and ahfce bits in the sc1_uartcr register (see table 30 ). whenever the hfce bit is set, the uart will not start transmitting a character unless ncts is low (asserted). if ncts transitions to the high state (deasserts) while a character is being transmitted, transmission of that character continues until it is complete. if the ahfce bit is set, nrts is controlled auto matically by hardware: nrts is put into the low state (asserted) when the receive fifo has room for at least two characters, otherwise is it in the high state (unasserted). if ahfce is clear, software controls the nrts output by setting or clearing the nrts bit in the sc1_uartcr register. software control of nrts is useful if the external serial device cannot st op transmitting characters promptly when nrts is set to the high state (deasserted). other device uart receiver uart transmitter stm32w108 uart transmitter uart receiver rxd txd nrts ncts txd rxd ncts nrts table 30. uart rts/cts flow control c onfigurations sc1_uartcr pins used operating mode sc1_uartxxx (1) hfce ahfce nrts 0 - - txd, rxd no rts/cts flow control 100/1 txd, rxd, ncts, nrts flow control using rts/cts with software control of nrts: nrts controlled by nrts bit in sc1_uartcr register 11- txd, rxd, ncts, nrts flow control using rts/cts with hardware control of nrts: nrts is asserted if room for at least 2 characters in receive fifo 1. the notation xxx means that the corresponding column header below is inserted to form the field name.
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 126/285 docid16252 rev 15 9.6.4 dma the dma channels section describes how to configure and use the serial receive and transmit dma channels. the receive dma channel has special provisions to record uart receive errors. when the dma channel transfers a character from the rece ive fifo to a buffer in memory, it checks the stored parity and frame error status flags. when an error is flagged, the sc1_dmarxerrar/sc1_dmarxerrbr register is updated, marking the offset to the first received character with a parity or fram e error. similarly if a receive overrun error occurs, the sc1_dmarxerrar/sc1_dmarxerrbr registers mark the error offset. the receive fifo hardware generates the ovr inte rrupt and dma status register indicates the error immediately, but in this case the error offset is 4 characters ahead of the actual overflow at the input to the receive fifo. tw o conditions will clear the error indication: setting the appropriate rxrst bit in the sc1_dmacr register, or loading the appropriate dma buffer after it has unloaded. 9.6.5 interrupts uart interrupts are generated on the following events: ? transmit fifo empty and last character shif ted out (depending on scx_icr, either the 0 to 1 transition or the high level of sc1_uarttxidle) ? transmit fifo changed from full to not full (depending on scx_icr, either the 0 to 1 transition or the high level of sc1_uarttxfree) ? receive fifo changed from empty to not em pty (depending on scx_icr, either the 0 to 1 transition or the high level of sc1_uartrxval) ? transmit dma buffer a/b complete (1 to 0 transition of txaack/txback) ? receive dma buffer a/b co mplete (1 to 0 transi tion of rxaack/rxback) ? character received with parity error ? character received with frame error ? character received and lost when receiv e fifo was full (receive overrun error) to enable cpu interrupts, set the desired interrupt bits in the second level scx_ier register. 9.7 direct memory a ccess (dma) channels the stm32w108 serial dma channels enable effi cient, high-speed operation of the spi and uart controllers by reducing the load on the cpu as well as decreasing the frequency of interrupts that it must service. the transm it and receive dma channels can transfer data between the transmit and receive fifos and the dma buffers in main memory as quickly as it can be transmitted or received. once so ftware defines, configures, and activates the dma, it only needs to handle an interrupt when a transmit buffer has been emptied or a receive buffer has been filled. the dma channels each support two memory buffers, labeled a and b, and can alternate ("ping-pong") between them automatically to allow continuous communication without crit ical interrupt timing.
docid16252 rev 15 127/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 note: dma memory buffer terminology: ? load - make a buffer available for the dma channel to use ? pending - a buffer loaded but not yet active ? active - the buffer that will be used for the next dma transfer ? unload - dma channel action when it has finished with a buffer ? idle - a buffer that has not been loaded, or has been unloaded to use a dma channel, software should follow these steps: ? reset the dma channel by setting the tx rst (or rxrst) bit in the scx_dmacr register. ? set up the dma buffers. the two dma buffers, a and b, are defined by writing the start address to scx_dmatxbegaddar/scx_dmatxbegaddbr (or scx_dmarxbegaddar/scx_dmarxbegaddbr) and the (inclusi ve) end address to scx_dmatxendaddar/s cx_dmatxendaddbr (or scx_dmarxendaddar/scx_dmarxendaddbr). note that dma buffers must be in ram. ? configure and initialize scx for the desired operating mode. ? enable second level interrupts triggered when dma buffers unload by setting the txuloda/b (or rxuloda/b) bits in the scx_isr register. ? start the dma by loading the dma buffers by setting the txloda/txlodb (or rxloda/rxlodb) bits in the scx_dmacr register. a dma buffer's end address, scx_dm atxendaddar/scx_dmatxendaddbr (or scx_dmarxendaddar/scx_dmarxendaddbr), can be written while the buffer is loaded or active. this is useful for receiving messages that contain an initial byte count, since it allows software to set the buffer end address at the last byte of the message. as the dma channel transfers data between the transmit or receive fifo and a memory buffer, the dma count register contains the byte offset from the start of the buffer to the address of the next by te that will be written or read. a transmit dma chan nel has a single dma count register (scx_dmatxcntr) that app lies to whichever transm it buffer is active, but a receive dma channel has two dma count registers (scx_dmarxcntar/scx_dmarxcntbr), one fo r each receive buffer. the dma count register contents are preserved until the corresponding buffer, or either buffer in the case of the transmit dma count, is loaded, or until the dma is reset. the receive dma count register may be written while the corresponding buffer is loaded. if the buffer is not loaded, writing the dma count register also loads the buffer while preserving the count value written. this feature can simplify handling uart receive errors. the dma channel stops using a buffer and unloads it when the following is true: (dma buffer start address + dma buffer count) > dma buffer end address typically a transmit buffer is unloaded after all its data has been sent, and a receive buffer is unloaded after it is filled with data, but writing to the buffer end address or buffer count registers can also cause a buffer to unload early. serial controller dma channels include additional features specific to the spi and uart operation and are described in those sections.
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 128/285 docid16252 rev 15 9.8 serial controlle r common registers 9.8.1 serial controller interr upt status register (scx_isr) address offset: 0xa808 (sc1_isr) and 0xa80c (sc2_isr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved pe fe txul odb txul oda rxul odb rxul oda nack cmd fin btf brf udr ovr idle txe rxne rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bit 31:15 reserved, must be kept at reset value bit 14 pe: parity error pending interrupt this bit is set by hardware when a parity error occurs in receiver mode. 0: no parity error pending interrupt 1: parity error pending interrupt note: not used in sc2 bit 13 fe: framing error pending interrupt this bit is set by hardware when a desynch ronization or excessive noise is detected. 0: no framing error detected pending interrupt 1: framing error pending interrupt note: not used in sc2 bit 12 txulodb: dma transmit buffer b unloaded pending interrupt this bit is set by hardware when dma load error is detected during transmission. 0: no dma transmit buffer b unloaded error pending interrupt 1: dma transmit buffer b unloaded pending interrupt bit 11 txuloda: dma transmit buffer a unloaded pending interrupt this bit is set by hardware when dma load error is detected during transmission. 0: no dma transmit buffer a unloaded error pending interrupt 1: dma transmit buffer a unloaded error pending interrupt. bit 10 rxulodb: dma receive buffer b unloaded pending interrupt this bit is set by hardware when dma load error is detected during reception. 0: no dma receive buffer b unloaded error pending interrupt 1: dma receive buffer b unloaded error pending interrupt bit 9 rxuloda: dma receive buffer a unloaded pending interrupt this bit is set by hardware when dma load error is detected during reception. 0: no dma receive buffer a unloaded error pending interrupt 1: dma receive buffer a unloaded error pending interrupt bit 8 nack: i 2 c not acknowledge received pending interrupt this bit is set by hardware when a nack is received after a byte transmission. 0: no nack detected pending interrupt 1: nack detected pending interrupt
docid16252 rev 15 129/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 bit 7 cmdfin: i 2 c command complete detection pending interrupt this bit is set by hardware when a stop or start command is generated correctly by the master. it is cleared by software writing it to 0. 0: no cmdfin detected pending interrupt 1: cmdfin detected pending interrupt bit 6 btf: i 2 c byte transmit finished pending interrupt this bit is set by hardware when t he transmit operation is completed. 0: data byte transmit not done pending interrupt 1: data byte transmit succeeded pending interrupt bit 5 brf: i 2 c byte receive finished pending interrupt this bit is set by hardware when the receive operation is completed. 0: data byte receive not done pending interrupt 1: data byte receive succeeded pending interrupt bit 4 udr: underrun pending interrupt this bit is set by hardware wh en data are transmitted and the previous data have not yet left the scx_dr register. 0: no underrun error pending interrupt 1: underrun error pending interrupt bit 3 ovr: overrun pending interrupt this bit is set by hardware when data are received and the previous data have not yet been read from scx_dr. as a resul t, the incoming data are lost. 0: no overrun error pending interrupt 1: overrun error pending interrupt bit 2 idle: idle line detected pending interrupt this bit is set by hardware when an idle line is detected. 0: no idle line detected pending interrupt 1: idle line detected pending interrupt bit 1 txe: transmit data register empty (transmitters) this bit is set by hardware when the scx_dr register is empty in transmission. 0: data register not empty pending interrupt 1: data register empty pending interrupt bit 0 rxne: data register not empty pending interrupt (receivers) this bit is set by hardware when the scx_dr register is not empty in receiver mode. 0: data is not received pending interrupt 1: received data is ready to be read pending interrupt
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 130/285 docid16252 rev 15 9.8.2 serial controller interr upt enable register (scx_ier) address offset: 0xa848 (sc1_ier) and 0xa84c (sc2_ier) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved peie feie txul odrie txul odaie rxul odbie rxul odaie nack ie cmd finie btfie brfie udrie ovrie idleie txeie rxneie rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bit 31:15 reserved, must be kept at reset value bit 14 peie: parity error interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: a uart interrupt is generated whenever pe=1 in the sc1_uartsr register. note: not used in sc2 bit 13 feie: frame error interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: a uart interrupt is generated whenever pe=1 in the sc1_uartsr register note: not used in sc2 bit 12 txulodrie: dma transmit buffer b unloaded interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: a dma transmit buffer b unloaded error interrupt is generated whenever txuloadb=1 in the sc1_uartsr register. bit 11 txulodaie: dma transmit buffer a unloaded interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: a dma transmit buffer a unloaded error interrupt is generated whenever txuloada=1 in the sc1_uartsr register. bit 10 rxulodbie: dma receive buffer b unloaded interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: a dma receive buffer b unloaded error inte rrupt is generated whenever rxuloadb=1 in the scx_isr register. bit 9 rxulodaie: dma receive buffer a unloaded interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: a dma receive buffer a unloaded error inte rrupt is generated whenever rxuloada=1 in the scx_isr register.
docid16252 rev 15 131/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 bit 8 nackie: i 2 c not acknowledge received interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: an i 2 c not acknowledge interrupt is generated whenever nack=1 in the scx_i2csr register. bit 7 cmdfinie: i 2 c command complete detection interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: an i 2 c command complete interrupt is generated whenever cmdfin=1 in the scx_i2csr register. bit 6 btfie: i 2 c byte transmit finished interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: an i 2 c byte transmit complete interrupt is generated whenever btf=1 in the scx_i2csr register. bit 5 brfie: i 2 c byte receive finished interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: an i 2 c byte receive complete interrupt is generated whenever brf=1 in the scx_i2csr register. bit 4 udrie: underrun interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: an underrun interrupt is generate d whenever und=1 in the scx_isr register bit 3 ovrie: overrun interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: an overrun interrupt is generated whenever ovr=1 in the scx_spisr register or ovr=1 in the scx_uartsr register or ovra/ovrb in the scx_dmasr register. bit 2 idleie: line detected interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: an idle line detect interrupt is generated w henever idle=1 in the scx_spisr register or idle=1 in the scx_uartsr register. bit 1 txeie: transmit data register empty interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: a transmit data register empty interrupt is generated whenever txe=1 in the scx_spisr register or txe=1 in the scx_uartsr register. bit 0 rxneie: data register not empty interrupt enable this bit is set and cleared by software. 0: interrupt is inhibited 1: a data register not empty interrupt is generated whenever rxne=1 in the scx_spisr register or rxne=1 in the scx_uartsr register.
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 132/285 docid16252 rev 15 9.8.3 serial controller interrup t control register 1 (scx_icr) address offset: 0xa854 (sc1_icr) and 0xa858 (sc2_icr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved idle level txe level rxne level rw rw rw bits 31:3 reserved, must be kept at reset value bit 2 idlelevel: trigger event configuration to generate the idle interrupt this bit is set and cleared by software. 0: idle interrupt is generated on edge 1: idle interrupt is generated on level bit 1 txelevel: trigger event configuration to generate the txe interrupt this bit is set and cleared by software. 0: txe interrupt is generated on edge 1: txe interrupt is generated on level bit 0 rnxnelevel: trigger event configuration to generate the rxne interrupt this bit is set and cleared by software. 0: rxne interrupt is generated on edge 1: rxne interrupt is generated on level
docid16252 rev 15 133/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.8.4 serial controller data register (scx_dr) address offset: 0xc83c (sc1_dr) and 0xc03c (sc2_dr) reset value: 0x0000 0000 9.8.5 serial controller c ontrol register 2 (scx_cr) address offset: 0xc854 (sc1_cr) and 0xc054 (sc2_cr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved dr[7:0] rw rw rw rw rw rw rw rw bits 31:8 reserved, must be kept at reset value bits 7:0 dr[7:0]: transmit and receive data register writing to this register adds a byte to the tran smit fifo. reading from this register takes the next byte from the receive fifo and clears the ov errun error bit if it was set. in uart mode (sc1 only), reading from this register loads the uart status register with the parity and frame error status of the next byte in the fi fo, and clears these bits if the fifo is empty. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved mode[1:0] rw rw bits 31:2 reserved, must be kept at reset value bits 1:0 mode[1:0]: serial controller mode selection this bit-field specifies the serial control operating mode 00: no mode selected 01: uart mode 10: spi mode 11: i2c mode note: if the uart mode is supported only by sc1
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 134/285 docid16252 rev 15 9.8.6 serial controller clo ck rate register 1 (scx_crr1) address offset: 0xc860 (sc1_crr1) and 0xc060 (sc2_crr1) reset value: 0x0000 0000 9.8.7 serial controller clo ck rate register 2 (scx_crr2) address offset: 0xc864 (sc1_crr2) and 0xc064 (sc2_crr2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved lin[3:0] rw rw rw rw bits 31:4 reserved, must be kept at reset value bits 3:0 lin[3:0]: the linear component of the clock rate in the equation: rate = 12 mhz / ( (lin + 1) * (2^exp) ) 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved exp[3:0] rw rw rw rw bits 31:4 reserved, must be kept at reset value bits 3:0 exp[3:0]: the expon ential component of the clock rate in the equation: rate = 12 mhz / ( (lin + 1) * (2^exp) )
docid16252 rev 15 135/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.9 serial controller: serial pe ripheral interface (spi) registers 9.9.1 serial controller spi status register (scx_spisr) address offset: 0xc840 (sc1_spisr) and 0xc040 (sc2_spisr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved idle txe rxne ovf rrrr bits 31:4 reserved, must be kept at reset value bit 3 idle: idle line detected flag this bit is set by hardware when both the transm it fifo and the transmit serializer are empty. an interrupt is generated if idleie=1 in the scx_ier register. 0: no spi idle line is detected 1: spi idle line is detected bit 2 txe: transmit data register empty flag (transmitters) this bit is set by hardware when the transmit fifo has space to accept at least one byte. an interrupt is generated if txeie = 1 in the scx_ier register. 0: spi fifo registers not empty 1: spi fifo registers empty bit 1 rxne: data register not empty flag (receivers) this bit is set by hardware when the receiver fi fo contains at least one byte. an interrupt is generated if rxneie=1 in the scx_ier register. 0: data is not received 1: received data is ready to be read bit 0 ovf: overrun flag this flag is set by hardware when data are received and the receiver fifo is full. as a result, the incoming data are lost. it is cleared by so ftware reading the scx_dr register. an interrupt is generated if ovrie=1 in the scx_ier register. 0: no overrun error occurred 1: overrun error occurred
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 136/285 docid16252 rev 15 9.9.2 serial controller spi control register (scx_spicr) address offset: 0xc858 (sc1_spicr) and 0xc058 (sc2_spicr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved rx mode mstr rp ten lsb first cpha cpol rw rw rw rw rw rw bits 31:6 reserved, must be kept at reset value bit 5 rxmode: receiver-dri ven mode selection bit (spi master mode only) 0: initiate transactions when transmit data is available. 1: initiate transactions when the re ceive buffer (fifo or dma) has space. force immediate transmission of busy token or resend last byte (depending on rpten ) and receive data into fifo until the fifo is full. bit 4 mstr: master selection 0: slave configuration 1: master configuration bit 3 rpten: repeat enable this bit controls behavior on a transmit buffer unde rrun condition in slave mode. clear this bit to send the busy token (0xff) and set this bit to repeat the last byte. changes to this bit take effect when the transmit fifo is em pty and the transmit serializer is idle. bit 2 lsbfirst: frame format 0: most significant bit transmitted first 1: least significant bit transmitted first bit 1 cpha: clock phase 0: the first clock transition is the first data capture edge 1: the second clock transition is the first data capture edge bit 0 cpol: clock polarity 0: ck to 0 when idle 1: ck to 1 when idle
docid16252 rev 15 137/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.10 serial controller: in ter-integrated circuit (i 2 c) registers 9.10.1 serial controller i 2 c status register (scx_i2csr) address offset: 0xc844 (sc1_i2csr) and 0xc044 (sc2_i2csr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved cmd fin brf btf nack rrrr bits 31:4 reserved, must be kept at reset value bit 3 cmdfin: comma nd finished flag this bit is set when a start or stop command completes. it is cleared on the next i 2 c bus activity. 0: start/ stop command transmission not done 1: start/ stop command transmission succeeded bit 2 brf: byte receive finished flag this bit is set when a byte is received. it clears on the next i 2 c bus activity. 0: data byte reception not done 1: data byte reception succeeded bit 1 btf: byte transfer finished flag this bit is set when a byte is tran smitted. it clears on the next i 2 c bus activity. 0: data byte transmission not done 1: data byte transmission succeeded bit 0 nack: not acknowledge flag this bit is set when a nack is received from the slave. it clears on the next i 2 c bus activity. 0: no nack received 1: nack receive succeeded
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 138/285 docid16252 rev 15 9.10.2 serial controller i 2 c control register 1 (scx_i2ccr1) address offset: 0xc84c (sc1_i2ccr1) and 0xc04c (sc2_i2ccr1) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved stop start bte bre rw rw rw rw bits 31:4 reserved, must be kept at reset value bit 3 stop: stop generation setting this bit sends the stop command. it clears when the command completes. 0: no stop condition generation 1: stop condition generation after current byte transfer bit 2 start: start generation setting this bit sends the start or repeated start command. it clears when the command completes. 0: no start generation. 1: restart/start generation. bit 1 bte: byte transmit enable setting this bit transmits a byte. it clears when the command completes. 0: data byte transmission disables 1: data byte transmission enables bit 0 bre: byte receive enable setting this bit receives a byte. it clears when the command completes. 0: data byte reception disables 1: data byte reception enables
docid16252 rev 15 139/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.10.3 serial controller i 2 c control register 2 (scx_i2ccr2) address offset: 0xc850 (sc1_i2ccr2) and 0xc050 (sc2_i2ccr2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved ack rw bits 31:1 reserved, must be kept at reset value bit 0 ack: not acknowledge generation 0: a nack is sent after current received byte 1: an ack is sent after current received byte
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 140/285 docid16252 rev 15 9.11 serial controller: univ ersal asynchronous receiver/ transmitter (uart) registers 9.11.1 serial controller uart status register (sc1_uartsr) address offset: 0xc848 reset value: 0x0000 0040 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved idle pe fe ovr txe rxne cts rrrrrrr bits 31:7 reserved, must be kept at reset value bit 6 idle: idle line detected flag this bit is set by hardware when both the transm it fifo and the transmit serializer are empty. an interrupt is generated if idleie=1 in the scx_ier register. 0: no uart idle line is detected 1: uart idle line is detected bit 5 pe: parity error flag this bit is set when the byte in the data register is received with a parity error. this bit is updated when the data register is read, and is cleared if the receive fifo is empty. an interrupt is generated if peie=1 in the scx_ier register. 0: no uart parity error 1: uart parity error bit 4 fe: frame error flag this bit is set when the byte in the data register is received with a frame error. this bit is updated when the data register is read, and is cleared if the receive fifo is empty. an interrupt is generated if feie =1 in the scx_ier register. 0: no uart frame error 1: uart frame error bit 3 ovr: overrun error flag this bit is set when the receive fifo has been overrun. this occurs if a byte is received when the receive fifo is full. this bit is cleared by reading the data register. an interrupt is generated if ovrie=1 in the scx_ier register. 0: no overrun error occurred 1: overrun error occurred
docid16252 rev 15 141/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.11.2 serial controller uart control register (sc1_uartcr) address offset: 0xc85c reset value: 0x0000 0000 bit 2 txe: transmit data register empty flag (transmitters) this bit is set when the transmit fifo has sp ace for at least one byte. an interrupt is generated if txeie=1 in the scx_ier register. 0: uart fifo registers not empty 1: uart fifo registers empty bit 1 rxne: receive data register not empty flag (receivers) this bit is set when the receive fifo contains at least one byte. an interrupt is generated if rxneie=1 in the scx_ier register. 0: data is not received 1: received data is ready to be read bit 0 cts: clear to send flag this bit is set by hardware when the ncts input toggles. 0: no change occurred on the ncts status line 1: a change occurred on the ncts status line 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved ahfce hfce ps pce stop m nrts rw rw rw rw rw rw rw bits 31:7 reserved, must be kept at reset value bit 6 ahfce: automatic hardware flow control enable it is set and cleared by software. 0: automatic hardware flow control disabled 1: automatic hardware flow control enabled bit 5 hfce: hardware flow control enable it is set and cleared by software. 0: hardware flow control disabled 1: hardware flow control enabled bit 4 ps: parity selection this bit selects the odd or even parity when the parity generation/detection is enabled (pce bit set). it is set and cleared by software. 0: even parity 1: odd parity
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 142/285 docid16252 rev 15 9.11.3 serial controller uart ba ud rate register 1 (sc1_uartbrr1) address offset: 0xc868 reset value: 0x0000 0000 bit 3 pce: parity control enable this bit selects the hardware parity contro l (generation and detection). when the parity control is enabled, the computed parity is insert ed at the msb position (9th bit if m=1; 8th bit if m=0) and parity is checked on the received data. this bit is set and cleared by software. 0: parity control disabled. 1: parity control enabled. bit 2 stop: number of stop bits t this bit is used for programming the stop bits. 0: 1 stop bit 1: 2 stop bits bit 1 m: word length this bit determines the word length. it is set or cleared by software. 0: 1 start bit, 7 data bits, parity bit if enabled, n stop bit 1: 1 start bit, 8 data bits, parity bit if enabled, n stop bit bit 0 nrts: request to send this bit controls the flow of the serial data received from another device. this bit directly controls the output at the nrts pin (hfce bi t must be set and ahfce bit must be cleared). it is set or cleared by software. 0: nrts is deasserted (pin is high, 'xof f', rs232 negative voltage); the other device's transmission is inhibited. 1: nrts is asserted (pin is low, 'xon', rs232 positive voltage); the other device's transmission is enabled. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 n[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bit 31:16 reserved, must be kept at reset value bits 15:0 n[15:0]: the integer part of baud rate period (n) in the equation: rate = 24 mhz / ( (2 * n) + f )
docid16252 rev 15 143/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.11.4 serial controller uart ba ud rate register 2 (sc1_uartbrr2) address offset: 0xc86c reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved f rw bits 31:1 reserved, must be kept at reset value bit 0 f: the fractional part of the baud rate period (f) in the equation: rate = 24 mhz / ( (2 * n) + f )
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 144/285 docid16252 rev 15 9.12 serial controller: direct memory access (dma) registers 9.12.1 serial controller receive dma begin address channel a register (scx_dmarxbegaddar) address offset: 0xc800 (sc1 _dmarxbegaddar) and 0xc000 (sc2_dmarxbegaddar) reset value: 0x2000 0000 9.12.2 serial controller receive dma end address channel a register (scx_dmarxendaddar) address offset: 0xc804 (sc1_dmarxendaddar) and 0xc004 (sc2_dmarxendaddar) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved add[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0 add[12:0]: dma receive buffer a start address 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved add[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0 add[12:0]: address of the last byte that is written in the dma receive buffer a.
docid16252 rev 15 145/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.12.3 serial controller receive dma begin address channel b register (scx_ dmarxbegaddbr) address offset: 0xc808 (sc1 _dmarxbegaddbr) and 0xc008 (sc2_dmarxbegaddbr) reset value: 0x2000 0000 9.12.4 serial controller receive dma end address channel b register (scx_dmarxendaddbr) address offset: 0xc80c (sc1_dmarxendaddbr) and 0xc00c (sc2_dmarxendaddbr) reset value: 0x2000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved add[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0 add[12:0]: dma receive buffer b start address 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved add[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0 add[12:0]: address of the last byte that is written in the dma receive buffer b.
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 146/285 docid16252 rev 15 9.12.5 serial controller transmit dma begin address channel a register (scx_dmatxbegaddar) address offset: 0xc810 (sc1 _dmatxbegaddar) and 0xc010 (sc2_dmatxbegaddar) reset value: 0x2000 0000 9.12.6 serial controller transmit dma end address channel a register (scx_dmatxendaddar) address offset: 0xc814 (sc1_dmatxendaddar) and 0xc014 (sc2_dmatxendaddar) reset value: 0x2000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved add[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0 add[12:0]: dma transmit buffer a start address 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved add[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0 add[12:0]: address of the last byte that is read from the dma transmit buffer a
docid16252 rev 15 147/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.12.7 serial controller transmit dma begin address channel b register (scx_dmatxbegaddbr) address offset: 0xc818 (sc1 _dmatxbegaddbr) and 0xc018 (sc2_dmatxbegaddbr) reset value: 0x2000 0000 9.12.8 serial controller transmit dma end address channel b register (scx_dmatxendaddbr) address offset: 0xc81c (sc1_dmatxendaddbr) and 0xc01c (sc2_dmatxendaddbr) reset value: 0x2000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved add[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0 add[12:0]: dma transmit buffer b start address 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved add[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0 add[12:0]: address of the last byte that is read from the dma transmit buffer b
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 148/285 docid16252 rev 15 9.12.9 serial controller recei ve dma counter channel a register (scx_dmarxcntar) address offset: 0xc820 (sc1_dmarx cntar) and 0xc020 (sc2_dmarxcntar) reset value: 0x0000 0000 9.12.10 serial controller rece ive dma count channel b register (scx_dmarxcntbr) address offset: 0xc824 (sc1_dmarx cntbr) and 0xc024 (sc2_dmarxcntbr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved cnt[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0 cnt[12:0]: the offset from the start of dma receive buffer a at which the next byte is written. this register is set to zero when the buffer is loaded and when the dma is reset. if this register is written when the buffer is not loaded, the buffer is loaded. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved cnt[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0 cnt[12:0]: the offset from the start of dma receive buffer b at which the next byte is written. this register is set to zero when the buffer is loaded and when the dma is reset. if this register is written when the buffer is not loaded, the buffer is loaded.
docid16252 rev 15 149/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.12.11 serial controller tr ansmit dma counter register (scx_dmatxcntr) address offset: 0xc828 (sc1_dma txcntr) and 0xc028 (sc2_dmatxcntr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved cnt[12:0] rrr r r r r r rr r r r bits 31:13 reserved, must be kept at reset value bits 12:0 cnt[12:0]: the offset from the start of the active dma tran smit buffer from which the next byte is read. this register is set to zero when the bu ffer is loaded and when the dma is reset.
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 150/285 docid16252 rev 15 9.12.12 serial controller dma status register (scx_dmasr) address offset: 0xc82c (sc1_dmasr) and 0xc02c (sc2_dmasr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved nsss feb fea peb pea ovrb ovra tx back tx aack rx back rx aack rrr r r r r r rr r r r bits 31:13 reserved, must be kept at reset value bits 12:10 nsss: status of the receive count saved in scx_dmarxcntsavedr (spi slave mode) when nssel deasserts. cleared when a receive buf fer is loaded and when the receive dma is reset. 0: no count was saved because nssel did not deassert 2: buffer a's count was sa ved, nssel deasserted once 3: buffer b's count was sa ved, nssel deasserted once 6: buffer a's count was saved, nssel deasserted more than once 7: buffer b's count was saved, nssel deasserted more than once 1, 4, 5: reserved, must be kept at reset value bit 9 feb: frame error b flag this bit is set when dma receive buffer b reads a byte with a frame error from the receive fifo. it is cleared the next time buffer b is loaded or when the receive dma is reset. 0: no dma buffer b frame error 1: dma buffer b frame error note: not used in sc2 bit 8 fea: frame error a flag this bit is set when dma receive buffer a reads a byte with a frame error from the receive fifo. it is cleared the next time buffer a is loaded or when the receive dma is reset. 0: no dma buffer a frame error 1: dma buffer a frame error note: not used in sc2 bit 7 peb: parity error b flag this bit is set when dma receive buffer b reads a byte with a parity error from the receive fifo. it is cleared the next time buffer b is loaded or when the receive dma is reset. 0: no dma buffer b parity error 1: dma buffer b parity error note: not used in sc2 bit 6 pea: parity error a flag this bit is set when dma receive buffer a reads a byte with a parity error from the receive fifo. it is cleared the next time buffer a is loaded or when the receive dma is reset. 0: no dma buffer a parity error 1: dma buffer a parity error note: not used in sc2
docid16252 rev 15 151/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 bit 5 ovrb: dma buffer b overrun flag this bit is set when dma receive buffer b is passed an overrun error from the receive fifo. neither receive buffer is capable of accepting any more bytes (unloaded), and the fifo fills up. buffer b is the next buffer to load, and when it drains the fifo the overrun error is passed up to the dma and flagged with this bit. it is cl eared the next time buffer b is loaded and when the receive dma is reset. 0: no dma receive buffer b overrun 1: dma receive buffer b overrun bit 4 ovra: dma buffer a overrun flag this bit is set when dma receive buffer a is passed an overrun error from the receive fifo. neither receive buffer is capable of accepting any more bytes (unloaded), and the fifo fills up. buffer a is the next buffer to load, and when it drains the fifo the overrun error is passed up to the dma and flagged with this bit. it is cl eared the next time buffer a is loaded and when the receive dma is reset. 0: no dma receive buffer a overrun 1: dma receive buffer a overrun bit 3 txback: dma transmit buffer b acknowledge flag this bit is set/reset by hardware when dma transmit buffer b is active. 0: dma transmit buffer b not active 1: dma transmit buffer b active bit 2 txaack: dma transmit buffer a acknowledge flag this bit is set/reset by hardware when dma transmit buffer a is active. 0: dma transmit buffer a not active 1: dma transmit buffer a active bit 1 rxback: dma receive buffer b acknowledge flag this bit is set/reset by hardware when dma receive buffer b is active. 0: dma receive buffer b not active 1: dma receive buffer b active bit 0 rxback: dma receive buffer a acknowledge flag this bit is set/reset by hardware when dma receive buffer a is active. 0: dma receive buffer b not active 1: dma receive buffer b active
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 152/285 docid16252 rev 15 9.12.13 serial controller dm a control register (scx_dmacr) address offset: 0xc830 (sc1_d macr) and 0xc030 (sc2_dmacr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved txrst rxrst tx lodb tx loda rx lodb rx loda w w rw rw rw rw bits 31:6 reserved, must be kept at reset value bit 5 txrst: setting this bit resets the transmit dma. this bit clears automatically. bit 4 rxrst: setting this bit resets the receive dma. this bit clears automatically. bit 3 txlodb: setting this bit loads dma transmit buffer b addresses and allows the dma controller to start processing transmit buffer b. if both buffer a and b are loaded simultaneously, buffer a is used first. this bit is cleared when dma complete s. writing a zero to this bit has no effect. reading this bit returns dma buffer status: 0: dma processing is complete or idle 1: dma processing is active or pending bit 2 txloda: setting this bit loads dma transmit buffer a addresses and allows the dma controller to start processing transmit buffer a. if both buffer a and b are loaded simultaneously, buffer a is used first. this bit is cleared when dma complete s. writing a zero to this bit has no effect. reading this bit returns dma buffer status: 0: dma processing is complete or idle 1: dma processing is active or pending bit 1 rxlodb: setting this bit loads dma receive buffer b addresses and allows the dma controller to start processing receive buffer b. if both buffer a and b are loaded simultaneously, buffer a is used first. this bit is cleared when dma complete s. writing a zero to this bit has no effect. reading this bit returns dma buffer status: 0: dma processing is complete or idle 1: dma processing is active or pending bit 0 rxloda: setting this bit loads dma receive buffer a addresses and allows the dma controller to start processing receive buffer a. if both buffer a and b are loaded simultaneously, buffer a is used first. this bit is cleared when dma complete s. writing a zero to this bit has no effect. reading this bit returns dma buffer status: 0: dma processing is complete or idle 1: dma processing is active or pending
docid16252 rev 15 153/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 9.12.14 serial controller receive dma channel a first error register (scx_dmarxerrar) address offset: 0xc834 (sc1_dmarxer rar) and 0xc034 (sc2_dmarxerrar) reset value: 0x0000 0000 9.12.15 serial controller receive dma channel b first error register (scx_dmarxerrbr) address offset: 0xc838 (sc1_dmarxer rbr) and 0xc038 (sc2_dmarxerrbr) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved add[12:0] rrr r r r r r rr r r r bits 31:13 reserved, must be kept at reset value bits 12:0 add[12:0]: the offset from the start of dma receive buffer a of the first byte received with a parity, frame, or overflow error. note that an overflow error occurs at the input to the receive fifo, so this offset is 4 bytes before the overflow position. if there is no error, it reads zero. this register is not updated by subsequent errors until the buffe r unloads and is reloaded, or the receive dma is reset. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved add[12:0] rrr r r r r r rr r r r bits 31:13 reserved, must be kept at reset value bits 12:0 add[12:0]: the offset from the start of dma receive buffer b of the first byte received with a parity, frame, or overflow error. note that an overflow error occurs at the input to the receive fifo, so this offset is 4 bytes before the overflow position. if there is no error, it reads zero. this register is not updated by subsequent errors until the buffe r unloads and is reloaded, or the receive dma is reset.
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 154/285 docid16252 rev 15 9.12.16 serial controller receive dma saved counter channel b register (scx_dmarxcntsavedr) address offset: 0xc870 (sc1 _dmarxcntsavedr) and 0xc070 (sc2_dmarxcntsavedr) reset value: 0x0000 0000 9.12.17 serial interface (sc1/sc2) register map table 31 gives the sc1/sc2 register map and reset values. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved cnt[12:0] rrr r r r r r rr r r r bits 31:13 reserved, must be kept at reset value bits 12:0 cnt[12:0]: receive dma count saved in spi slave mode when nssel deasserts. the count is only saved the first time nssel deasserts. table 31. sc1/sc2 register map and reset values offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0xa808 sc1_isr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. pe fe txulodb txuloda rxulodb rxuloda nack cmdfin btf brf udr ovr idle txe rxne reset value 000000000000000 0xa848 sc1_ier res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. peie feie txulodrie txulodaie rxulodbie rxulodaie nackie cmdfinie btfie brfie udrie ovrie idleie txeie rxneie reset value 000000000000000 0xa854 sc1_icr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. idlelevel txelevel rxnelevel reset value 000 0xc83c sc1_dr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. dr[7:0] reset value 00000000
docid16252 rev 15 155/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 0xc854 sc1_cr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. mode[1:0] reset value 00 0xc860 sc1_crr1 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. lin[3:0] reset value 00000 0xc864 sc1_crr2 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. exp[3:0] reset value 00000 0xc840 sc1_spisr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. idle txe rxne ovf reset value 0000 0xc858 sc1_spicr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. rxmode mstr rpten lsbfirst cpha cpol reset value 000000 0xc844 sc1_i2csr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cmdfin brf btf nack reset value 0000 0xc84c sc1_i2crr1 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. stop start bte bre reset value 0000 0xc850 sc1_i2crr2 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ack reset value 0 0xc848 sc1_uartsr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. idle pe fe ovr txe rxne cts reset value 1000000 0xc85c sc1_uartcr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ahfce hfce ps pce stop m nrts reset value 0000000 0xc868 sc1_uartbrr1 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. n[15:0] reset value 0000000000000000 0xc86c sc1_uartbrr2 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. f reset value 0 0xc800 sc1_dmarx begaddar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc804 sc1_dmarx endaddar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc808 sc1_dmarx begaddbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 table 31. sc1/sc2 register map and reset values (continued) offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 156/285 docid16252 rev 15 0xc80c sc1_dmarx endaddbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc810 sc1_dmatx begaddar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc814 sc1_dmatx endaddar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc818 sc1_dmatx begaddbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc81c sc1_dmatx endaddbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc820 sc1_dmarx cntar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cnt[12:0] reset value 0000000000000 0xc824 sc1_dmarx cntbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cnt[12:0] reset value 0000000000000 0xc828 sc1_dmatx cntr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cnt[12:0] reset value 0000000000000 0xc82c sc1_dmasr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. nsss [2:0] feb fea peb pea ovrb ovra txback txaack rxback rxaack reset value 0000000000000 0xc830 sc1_dmacr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. txrst rxrst txlodb txloda rxlodb rxloda reset value 000000 0xc834 sc1_dmarx errar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc838 sc1_dmarx errbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc870 sc1_dmarx cntsavedr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cnt[12:0] reset value 0000000000000 0xa80c sc2_isr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. pe fe txulodb txuloda rxulodb rxuloda nack cmdfin btf brf udr ovr idle txe rxne reset value 000000000000000 0xa84c sc2_ier res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. peie feie txulodrie txulodaie rxulodbie rxulodaie nackie cmdfinie btfie brfie udrie ovrie idleie txeie rxneie reset value 000000000000000 table 31. sc1/sc2 register map and reset values (continued) offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
docid16252 rev 15 157/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz serial interfaces 281 0xa858 sc2_icr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. idlelevel txelevel rxnelevel reset value 000 0xc03c sc2_dr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. dr[7:0] reset value 00000000 0xc054 sc2_cr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. mode[1:0] reset value 00 0xc060 sc2_crr1 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. lin[3:0] reset value 00000 0xc064 sc2_crr2 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. exp[3:0] reset value 00000 0xc040 sc2_spisr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. idle txe rxne ovf reset value 0000 0xc058 sc2_spicr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. rxmode mstr rpten lsbfirst cpha cpol reset value 000000 0xc044 sc2_i2csr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cmdfin brf btf nack reset value 0000 0xc04c sc2_i2crr1 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. stop start bte bre reset value 0000 0xc050 sc2_i2crr2 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ack reset value 0 0xc000 sc2_dmarx begaddar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc004 sc2_dmarx endaddar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc008 sc2_dmarx begaddbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc00c sc2_dmarx endaddbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 table 31. sc1/sc2 register map and reset values (continued) offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
serial interfaces stm32w108hb stm32w108cc stm32w108cb stm32w108cz 158/285 docid16252 rev 15 refer to figure 4: stm32w108xb memory mapping, figure 5: stm32w108cc and stm32w108cz memory mapping, and table 3: stm32w108xx peripheral register boundary addresses for the register boundary addresses of the peripherals available in all stm32w108xx devices. 0xc010 sc2_dmatx begaddar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc014 sc2_dmatx endaddar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc018 sc2_dmatx begaddbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc01c sc2_dmatx endaddbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc020 sc2_dmarx cntar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cnt[12:0] reset value 0000000000000 0xc024 sc2_dmarx cntbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cnt[12:0] reset value 0000000000000 0xc028 sc2_dmatx cntr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cnt[12:0] reset value 0000000000000 0xc02c sc2_dmasr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. nsss [2:0] feb fea peb pea ovrb ovra txback txaack rxback rxaack reset value 0000000000000 0xc030 sc2_dmacr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. txrst rxrst txlodb txloda rxlodb rxloda reset value 000000 0xc034 sc2_dmarx errar res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc038 sc2_dmarx errbr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. add[12:0] reset value 0000000000000 0xc070 sc2_dmarx cntsavedr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cnt[12:0] reset value 0000000000000 table 31. sc1/sc2 register map and reset values (continued) offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
docid16252 rev 15 159/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10 general-purpose timers each of the stm32w108's two general-purpose timers consists of a 16-bit auto-reload counter driven by a programmable prescaler. they may be used for a variety of purposes, including measuring the pulse lengths of input signals (input capture) or generating output waveforms (output compare and pwm). pulse lengths and waveform periods can be modulated from a few mi croseconds to several milliseconds using the timer prescaler. the timers are completely independent, and do not share any resources. they can be synchronized together as described in section 10.1.14: timer synchronization on page 189 . the two general-purpose timers, tim1 and tim2, have the following features: ? 16-bit up, down, or up/down auto-reload counter. ? programmable prescaler to divide the count er clock by any power of two from 1 through 32768. ? 4 independent channels for: ? input capture ? output compare ? pwm generation (edge- and center-aligned mode) ? one-pulse mode output ? synchronization circuit to control the timer with external signals and to interconnect the timers. ? flexible clock source selection: ? peripheral clock (pclk at 6 or 12 mhz) ? 32 khz hse osc (if available) ? 1 khz clock ? gpio input ? interrupt generation on the following events: ? update: counter overflow /underflow, counter initialization (software or internal/external trigger) ? trigger event (counter start, stop, initializ ation or count by internal/external trigger) ? input capture ? output compare ? supports incremental (quadrature) enc oders and hall sensors for positioning applications. ? trigger input for external clock or cycle-by-cycle current management. note: because the two timers are identical, the nota tion timx refers to ei ther tim1 or tim2. for example, timx_psc refers to both tim1_psc and tim2_psc. similarly, "y" refers to any of the four channels of a given timer, so for example, ocy refers to oc1, oc2, oc3, and oc4.
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 160/285 docid16252 rev 15 figure 15. general-purpose timer block diagram note: the internal signals shown in figure 15 are described in section 10.1.15: timer signal descriptions on page 195 and are used throughout the text to describe how the timer components are interconnected.
docid16252 rev 15 161/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.1 functional description the timers can optionally use gpios in the pa and pb ports for external inputs or outputs. as with all stm32w108 digital inputs, a gpio used as a timer input can be shared with other uses of the same pin. available timer in puts include an external timer clock, a clock mask, and four input channels. any gpio used as a timer output must be configured as an alternate output and is co ntrolled only by the timer. many of the gpios that can be assigned as timer outputs can also be used by another on- chip peripheral such as a serial controller. use as a timer output takes precedence over another peripheral function, as long as the channel is configured as an output in the timx_ccmr1 register and is enabl ed in the timx_ccer register. the gpios that can be used by timer 1 are fi xed, but the gpios that can be used as timer 2 channels can be mapped to either of two pins, as shown in table 32 . the timer 2 option register (tim2_or) has four single bit fields (remapcy) that control whether a timer 2 channel is mapped to its default gpio in port pa, or remapped to a gpio in pb. table 32 specifies the pins that may be assigned to timer 1 and timer 2 functions. the timxclk and timxmsk inputs can be used onl y in the external clock modes: refer to the external clock source mode 1 and external clock source mode 2 sections for details concerning their use. 10.1.1 time-base unit the main block of the general purpose timer is a 16-bit counter with its related auto-reload register. the counter can count up, down, or alternate up and down. the counter clock can be divided by a prescaler. the counter, the auto-reload register, and the prescaler register can be written to or read by software. this is true even when the counter is running. the time-base unit includes: ? counter register (timx_cnt) ? prescaler register (timx_psc) ? auto-reload register (timx_arr) some timer registers cannot be directly accessed by software, which instead reads and writes a "buffer register". the internal register s actually used for timer operations are called "shadow registers". table 32. timer gpio use signal (d irection) timxc1 (in or out) timxc2 (in or out) timxc3 (in or out) timxc4 (in or out) timxclk (in) timxmsk (in) timer 1 pb6 pb7 pa6 pa7 pb0 pb5 timer 2 (remapcy = 0) pa0 pa3 pa1 pa2 pb5 pb0 timer 2 (remapcy = 1) pb1 pb2 pb3 pb4 pb5 pb0
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 162/285 docid16252 rev 15 the auto-reload register is buffered. writing to or reading from the auto-reload register accesses the buffer register. the contents of the buffer register are transferred into the shadow register permanently or at each update event (uev), depending on the auto-reload buffer enable bit (arpe) in the timx_cr1 re gister. the update event is generated when both the counter reaches the overflow (or underflow when down-counting) and when the udis bit equals 0 in the timx_cr1 register. it can also be generated by software. update event generation is described in detail for each configuration. the counter is clocked by the prescaler out put ck_cnt, which is enabled only when the counter enable bit (cen) in t he timx_cr1 register is set. refer also to the slave mode controller description in the timers and external trigger synchronization section to get more details on counter enabling. note that the actual counte r enable signal cnt_en is set one clock cycle after cen. note: when the stm32w108 enters debug mode and the arm? cortex-m3 core is halted, the counters continue to run normally. prescaler the prescaler can divide the counter clock freq uency by power of two from 1 through 32768. it is based on a 16-bit counter controlled through the 4-bit psc[3:0] in the timx_psc register. the factor by which the internal timer clock frequency (f ck_psc ) is divided is two raised to the power psc[3:0]: it can be changed on the fly as this control register is buffered. the new prescaler ratio is used starting at the next update event. figure 16 gives an example of the counter behavior when the prescaler ratio is changed on the fly. figure 16. counter timing diagram with pr escaler division change from 1 to 4 ck_cnt f ck_psc 2 ^ psc[3:0] () ? =
docid16252 rev 15 163/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.1.2 counter modes up-counting mode in up-counting mode, the counter counts from 0 to the auto-reload value (contents of the timx_arr register), then restarts from 0 and generates a coun ter overflow event. an update event can be generated at each coun ter overflow, by setting the ug bit in the timx_egr register, or by using the slave mode controller. software can disable the update event by settin g the udis bit in the timx_cr1 register, to avoid updating the shadow registers while writing new values in the buffer registers. no update event will occur until the udis bit is wr itten to 0. both the counter and the prescalar counter restart from 0, but the prescale rate does not change. in addition, if the urs bit in the timx_cr1 register is set, setting the ug bit generates an update event but without setting the uif flag. thus no interrupt request is sent . this avoids generating both update and capture interrupts when clearing the counter on the capture event. when an update event occurs, the update flag (t he uif bit in the timx_sr register) is set (depending on the urs bit in the timx_cr1 register) and the following registers are updated: ? the buffer of the prescaler is reloaded with the buffer value (contents of the timx_psc register). ? the auto-reload shadow register is updated with the buffer value (timx_arr). figure 17 , figure 18 , figure 19 , and figure 20 show some examples of the counter behavior for different clock frequencies when timx_arr = 0x36. figure 17. counter timing diagram, internal clock divided by 1 ck_int cnt_en timer clock = ck_cnt counter register counter overflow update event (uev) update interrupt flag ms30520v1 32 31 33 34 35 36 00 02 01 03 04 05 06 07 (uif)
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 164/285 docid16252 rev 15 figure 18. counter timing diagram, internal clock divided by 4 figure 19. counter timing diagram, update event when arpe = 0 (timx_arr not buffered) ck_int cnt_en timer clock = ck_cnt counter register counter overflow update event (uev) update interrupt flag 0001 0000 0035 0036 ms30521v1 (uif) 00 cnt_en timer clock = ck_cnt counter register update interrupt flag (uif) counter overflow update event (uev) 01 02 03 04 05 06 07 32 33 34 35 3 6 31 auto-reload register ff 36 write a new value in timx_arr ck_int
docid16252 rev 15 165/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 figure 20. counter timing diagram, update event when arpe = 1 (timx_arr buffered) down-counting mode in down-counting mode, the counter counts from the auto-reload value (contents of the timx_arr register) down to 0, then restarts from the auto-reload value and generates a counter underflow event. an update event can be generated at each coun ter underflow, by setting the ug bit in the timx_egr register, or by using the slave mode controller). software can disable the update event by setting the udis bit in the timx_cr1 register, to avoid updating the shadow registers while writing new values in the buffer registers. no update event occurs until the udis bit is written to 0. howeve r, the counter restar ts from the current auto-reload value, whereas the prescalar's counter restarts from 0, but the prescale rate doesn't change. in addition, if the urs bit in the timx_cr1 re gister is set, setting the ug bit generates an update event, but wit hout setting the uif flag. thus no interrupt request is sent. this avoids generating both update and capture interrupts when clearing the counter on the capture event. when an update event occurs, the update flag (t he uif bit in the timx_sr register) is set (depending on the urs bit in the timx_cr1 register) and the following registers are updated: ? the prescaler shadow register is reload ed with the buffer value (contents of the timx_psc register). ? the auto-reload active register is updated with the buffer value (contents of the timx_arr register). the auto-re load is updated before the counter is reloaded, so that the next period is the expected one. figure 21 and figure 22 show some examples of the counter behavior for different clock frequencies when timx_arr = 0x36. 00 cnt_en timer clock = ck_cnt counter register update interrupt flag (uif) counter overflow update event (uev) 01 02 03 04 05 06 07 f1 f2 f3 f4 f5 f0 auto-reload buffer register f5 36 auto-reload shadow register f5 36 write a new value in timx_arr ck_psc
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 166/285 docid16252 rev 15 figure 21. counter timing diagram, internal clock divided by 1 figure 22. counter timing diagram, internal clock divided by 4 center-aligned mode (up/down counting) in center-aligned mode, the counter counts from 0 to the auto-reload value (contents of the timx_arr register) - 1 and generates a counter overflow event, then counts from the autoreload value down to 1 and generates a counter underflow event. then it restarts counting from 0. in this mode, the direction bit (d ir in the timx_cr1 register) cannot be written. it is updated by hardware and gives the current direction of the counter. the update event can be generated at each counter overflow and at each counter underflow. setting the ug bit in the timx_egr register by software or by using the slave mode controller also generates an update event. in this case, the both the counter and the prescalar's counter restart counting from 0. software can disable the update event by sett ing the udis bit in the timx_cr1 register. this avoids updating the shadow registers while writing new values in the buffer registers. then no update event occurs unt il the udis bit has been written to 0. however, the counter continues counting up and down, based on the current auto-reload value. ck_int 36 cnt_en timer clock = ck_cnt counter register update interrupt flag (uif) counter underflow (cnt_udf) update event (uev) 35 34 33 32 31 30 2f 04 03 02 01 00 05 0036 0035 cnt_en timer clock = ck_cnt counter register update interrupt flag (uif) 0001 0000 counter underflow update event (uev) ck_int
docid16252 rev 15 167/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 in addition, if the urs bit in the timx_cr1 re gister is set, setting the ug bit generates an update event, but wit hout setting the uif flag. thus no interrupt request is sent. this avoids generating both update and capture interrupt when clearing the counter on the capture event. when an update event occurs, the update flag (t he uif bit in the timx_sr register) is set (depending on the urs bit in the timx_cr1 register) and the following registers are updated: ? the prescaler shadow register is reload ed with the buffer value (contents of the timx_psc register). ? the auto-reload active register is updated with the buffer value (contents of the timx_arr register). if the update source is a counter ov erflow, the auto-reload is updated before the counter is reloaded, so that the next period is the expected one. the counter is loaded with the new value. the following figures show some examples of the counter behavior for different clock frequencies. figure 23. counter timing di agram, internal clock divided by 1, timx_arr = 0x6 ck_int 02 cnt_en timer clock = ck_cnt counter register update interrupt flag (uif) counter underflow update event (uev) 03 04 05 06 05 04 03 03 02 01 00 01 04 counter overflow
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 168/285 docid16252 rev 15 figure 24. counter timing diagram, update event with arpe = 1 (counter underflow) figure 25. counter timing diagram, update event with arpe = 1 (counter overflow) 00 cnt_en timer clock = ck_cnt counter register update interrupt flag (uif) counter underflow update event (uev) 01 02 03 04 05 06 07 05 04 03 02 01 06 auto-reload buffer register fd 36 write a new value in timx_arr auto-reload shadow register fd 36 ck_int 36 cnt_en timer clock = ck_cnt counter register update interrupt flag (uif) counter overflow update event (uev) 35 34 33 32 31 30 2f f8 f9 fa fb fc f7 auto-reload buffer register fd 36 write a new value in timx_arr auto-reload shadow register fd 36 ck_int
docid16252 rev 15 169/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.1.3 clock selection the counter clock can be provided by the following clock sources: ? internal clock (pclk) ? external clock mode 1: external input pin (tiy) ? external clock mode 2: external trigger input (etr) ? internal trigger input (itr0): using the other timer as prescaler. refer to the using one timer as prescaler for the other timer for more details. internal clock source (ck_int) the internal clock is selected when the slave mode controller is disabled (sms = 000 in the timx_smcr register). in this mode, the cen, dir (in the timx_cr1 register), and ug bits (in the timx_egr register) ar e actual control bits and ca n be changed only by software, except for ug, which rema ins cleared automatically. as soon as the cen bit is written to 1, the prescaler is clocked by the internal clock ck_int. figure 26 shows the behavior of the control circ uit and the up-counter in normal mode, without prescaling. figure 26. control circuit in normal mode, internal clock divided by 1 external clock source mode 1 this mode is selected when sms = 111 in t he timx_smcr register. the counter can count at each rising or falling edge on a selected input. ck_int 00 counter clock = ck_cnt = ck_psc counter register 01 02 03 04 05 06 07 32 33 34 35 36 31 cen=cnt_en ug cnt_init
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 170/285 docid16252 rev 15 figure 27. ti2 external clock connection example for example, to configure the up-counter to count in response to a rising edge on the ti2 input, use the following procedure: 1. configure channel 2 to detect rising edges on the ti2 input by writing cc2s = 01 in the timx_ccmr1 register. 2. configure the input filter duration by writin g the ic2f bits in the timx_ccmr1 register (if no filter is needed, keep ic2f = 0000). note: the capture prescaler is not used for triggering, so it does not need to be configured. 3. select rising edge polarity by writ ing cc2p = 0 in the timx_ccer register. 4. configure the timer in external clock mode 1 by writing sms = 111 in the timx_smcr register. 5. select ti2 as the input source by wr iting ts = 110 in the timx_smcr register. 6. enable the counter by writing cen = 1 in the timx_cr1 register. when a rising edge occurs on ti2, the counter counts once and the tie flag is set. the delay between the rising edge on ti2 and the actual clock of the counter is due to the resynchronization circuit on the ti2 input. figure 28. control circuit in external clock mode 1 ck_int encoder mode external clock mode 1 external clock mode 2 internal clock mode etrf trgi ti1f ti2f or or ck_psc timx_smcr sms[2:0] itrx ti1f_ed ti1fp1 ti2fp2 etrf timx_smcr ts[2:0] ti2 0 1 timx_ccer cc2p filter ic2f[3:0] timx_ccmr1 edge detector ti2f_rising ti2f_falling 110 001 100 101 111 (internal clock) or ece counter clock = ck_cnt = ck_psc counter register 35 36 34 ti2 cnt_en tie write uie=0
docid16252 rev 15 171/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 external clock source mode 2 this mode is selected by writing ece = 1 in the timx_smcr register. the counter can count at each rising or falling edge on the external trigger input etr. the extrigsel bits in the timx_or register select a clock signal that drives etr, as shown in table 33 . figure 29 gives an overview of the external trigger input block. figure 29. external trigger input block for example, to configure the up-counter to count each 2 rising edges on etr, use the following procedure: ? as no filter is needed in this example, write etf = 0000 in the timx_smcr register. ? set the prescaler by writing etps = 01 in the timx_smcr register. ? select rising edge detection on etr by writing etp = 0 in the timx_smcr register. ? enable external clock mode 2 by writ ing ece = 1 in the timx_smcr register. ? enable the counter by writing cen = 1 in the timx_cr1 register. the counter counts once each 2 etr rising edges. the delay between the rising edge on etr and the actual clock of the counter is due to the resynchronization circuit on the etrp signal. table 33. extrigsel clock signal selection extrigsel bits clock signal selection 00 pclk (peripheral clock). when running from the 24 mhz hse osc, the pclk frequency is 12 mhz. when the 12 mhz hsi rc oscillator is in use, the frequency is 6 mhz. 01 calibrated 1 khz internal rc oscillator 10 optional 32 khz hse osc 11 timxclk pin. if the clkmsken bit in the timx_or register is set, this signal is and'ed with the timxmsk pin providing a gated clock input. etr 0 1 timx_smcr divider /1, /2, /4, /8 etrp filter downcounter ck_int timx_smcr timx_smcr ck_int encoder mode external clock mode 1 external clock mode 2 internal clock mode etrf trgi ti1f ti2f or or or (internal clock) ck_psc timx_smcr sms[2:0] etr ece etf[3:0] etps[1:0] etp
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 172/285 docid16252 rev 15 figure 30. control circuit in external clock mode 2 10.1.4 capture/compare channels each capture/compare channel is built around a capture/compare register including a shadow register, an input stage for capture with digital filter, multiplexing and prescaler, and an output stage with comparator and output control. figure 31 gives an overview of one capture/compare channel. the input stage samples the corresponding tiy input to generate a filtered signal (tiyf). then an edge detector with polarity selection generates a signal (tiyfpy) which can be used either as trigger input by the slave mode controller or as the capture command. it is prescaled before the capture register (icyps). figure 31. capture/compare channel (example: channel 1 input stage) the output stage generates an intermediate reference signal, ocyref, which is only used internally. ocyref is always active high, but it may be inverted to create the output signal, ocy, that controls a gpio output. counter clock = ck_cnt = ck_psc counter register 35 36 34 etr cnt_en f ma s ter etrp etrf ti1 timx_ccer cc1p divider /1, /2, /4, /8 ic1psc[1:0] ti1f_ed filter ic1f[3:0] downcounter timx_ccmr1 edge detector ti1f_rising ti1f_falling to the slave mode controller ti1fp1 11 01 timx_ccmr1 cc1s[1:0] ic1 ti2fp1 trc (from channel 2) (from slave mode controller) 10 f dts timx_ccer ic1ps ti1f ti2f_rising ti2f_falling (from channel 2) ccie
docid16252 rev 15 173/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 figure 32. capture/compare channel 1 main circuit figure 33. output stage of capture/compare channel (channel 1) the capture/compare block is made of a buffer register and a shadow register. writes and reads always access th e buffer register. in capture mode, captures are first written to the shadow register, then copied into the buffer register. in compare mode, the content of the buffer register is copied into the shadow register which is compared to the counter. cc1e capture/compare shadow register comparator capture/compare buffer register counter ic1psc[1:0] cc1s cc1s capture input mode s r read ccr1[31:16] read ccr1[15:0] read_in_progress capture_transfer cc1s cc1s s r write ccr1[31:16] write ccr1[15:0] write_in_progress output mode uev oc1pe (from time compare_transfer apb bus 8 8 high low (if 16-bit) mcu-peripheral interface timx_ccmr1 oc1pe base unit) timx_cnt>timx_ccr1 timx_egr cc1g timx_cnt=timx_ccr1 output mode timx_cnt > timx_ccr1 controller timx_ccmr1 oc1m[2:0] oc1ref 0 1 timx_ccer output enable circuit oc1 timx_ccer to the master mode controller etrf ai17187b cc1p cc1e timx_cnt = timx_ccr1
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 174/285 docid16252 rev 15 10.1.5 input capture mode in input capture mode, a capture/compare regi ster (timx_ccry) latches the value of the counter after a transition is detected by t he corresponding icy signal. when a capture occurs, the corresponding ccyif flag in the timx_sr register is set, and an interrupt request is sent if enabled. if a capture occurs when the ccyif flag is already high, then the mi ssed capture flag ccyim in the timx_missr register is set. ccyif can be cleared by software writing a 1 to its bit or reading the captured data stored in the timx_ccry register. to clear the ccyif bit, write a 1 to it. the following example shows how to capture t he counter value in the timx_ccr1 when the ti1 input rises. ? select the active input: timx_ccr1 must be linked to the ti1 input, so write the cc1s bits to 01 in the timx_ccmr1 register. as soon as cc1s becomes different from 00, the channel is configured in input and the timx_ccr1 register becomes read-only. ? program the required input filter duration with respect to the signal connected to the timer, when the input is one of the tiy (icyf bits in the timx_ccmr1 register). consider a situation in which, when toggling, the input signal is unstable during at most 5 internal clock cycles. the filter duration mu st be longer than th ese 5 clock cycles. the transition on ti1 can be validated when 8 consecutive samples with the new level have been detected (sampled at pclk frequency). to do this, write the ic1f bits to 0011 in the timx_ccmr1 register. ? select the edge of the active transition on th e ti1 channel by writing the cc1p bit to 0 in the timx_ccer register (rising edge in this case). ? program the input prescaler: in this example, the capture is to be performed at each valid transition, so the prescaler is disabled (write the ic1psc bits to 00 in the timx_ccmr1 register). ? enable capture from the counter into the capt ure register by setting the cc1e bit in the timx_ccer register. ? if needed, enable the related interrupt reques t by setting the cc1ie bit in the timx_ier register. ? when an input capture occurs: ? the timx_ccr1 register gets the value of the counter on th e active transition. ?cc1if flag is set (capture/compa re interrupt flag). the missed capture/compare flag cc1im in timx_missr is also set if another capture occurs before the cc1if flag is cleared. ? an interrupt may be generated if enabled by the cc1if bit. to detect missed captures reliably, read captured data in timx_ccry before checking the missed capture/compare flag. this sequence avoids missing a capture that could happen after reading the flag and before reading the data. note: software can generate ic interrupt requests by setting the corresponding ccyg bit in the timx_egr register.
docid16252 rev 15 175/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.1.6 pwm input mode this mode is a particular case of input c apture mode. the procedure is the same except: ? two icy signals are mapped on the same tiy input. ? these two icy signals are active on edges with opposite polarity. ? one of the two tiyfp signals is selected as trigger input and the slave mode controller is configured in reset mode. for example, to measure the period in the timx_ccr1 register and the duty cycle in the timx_ccr2 register of the pwm applied on ti1, use the following procedure depending on ck_int frequency and prescaler value: ? select the active input for timx_ccr1: write the cc1s bits to 01 in the timx_ccmr1 register (ti1 selected). ? select the active polarity for ti1fp1, used both for capture in the timx_ccr1 and counter clear, by writing the cc1p bit to 0 (active on rising edge). ? select the active input fo r timx_ccr2 by writing the cc2s bits to 10 in the timx_ccmr1 register (ti1 selected). ? select the active polarity for ti1fp2 (us ed for capture in the timx_ccr2) by writing the cc2p bit to 1 (active on falling edge). ? select the valid trigger input by writing the ts bits to 101 in the timx_smcr register (ti1fp1 selected). ? configure the slave mode controller in reset mode by writing the sms bits to 100 in the timx_smcr register. ? enable the captures by writing the cc1e and cc2e bits to 1 in the timx_ccer register. figure 34. pwm input mode timing ti1 tim x_cnt 0000 0001 0002 0003 0004 0000 0004 timx_ccr1 timx_ccr2 0004 0002 ic1 capture ic2 capture reset counter ic2 capture pulse wi dth ic1 capture period measurement measurement ai15413b
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 176/285 docid16252 rev 15 10.1.7 forced output mode in output mode (ccys bits = 00 in the timx_ccmr1 register), software can force each output compare signal (ocyref and then ocy) to an active or inactive level independently of any comparison between the output compare register and the counter. to force an output compare signal (ocyref/ocy) to its active level, write 101 in the ocym bits in the corresponding timx_ccmr1 regi ster. ocyref is forced high (ocyref is always active high) and ocy gets the opposite value to the ccyp polarity bit. for example, ccyp = 0 defines ocy as active high, so when ocyref is active, ocy is also set to a high level. the ocyref signal can be forced low by writing the ocym bits to 100 in the timx_ccmr1 register. the comparison betwe en the timx_ccry shadow register an d the counter is still performed and allows the ccyif flag to be set. interrupt requests can be sent accordingly. this is described in section 10.1.8: output compare mode on page 176 . 10.1.8 output compare mode this mode is used to control an output wave form or to indicate wh en a period of time has elapsed. when a match is found between the capture/co mpare register and the counter, the output compare function: ? assigns the corresponding output pin to a programmable value defined by the output compare mode (the ocym bits in the timx _ccmr1 register) and the output polarity (the ccyp bit in the timx_ccer regist er). the output can remain unchanged (ocym = 000), be set active (ocym = 001), be set inactive (ocym = 010), or can toggle (ocym = 011) on the match. ? sets a flag in the interrupt flag register (the ccyif bit in the timx_sr register). ? generates an interrupt if the corresponding in terrupt mask is set (t he ccyie bit in the timx_ier register). the timx_ccry registers can be programmed with or without buffer registers using the ocype bit in the timx_ccmr1 register. in output compare mode, the update event has no effect on ocyref or the ocy output. the timing resolution is one count of the counter. output compare mode can also be used to output a single pulse (in one pulse mode). procedure: 1. select the counter clock (int ernal, external, and prescaler). 2. write the desired data in the timx_arr and timx_ccry registers. 3. set the ccyie bit in timx_ier if an interrupt request is to be generated. 4. select the output mode. for example, you must write ocym = 011, ocype = 0, ccyp = 0 and ccye = 1 to toggle t he ocy output pin when timx_cnt matches timx_ccry, timx_ccry buffer is not us ed, ocy is enabled and active high. 5. enable the counter by setting the cen bit in the timx_cr1 register.
docid16252 rev 15 177/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 to control the output waveform, software ca n update the timx_ccry register at any time, provided that the buffer register is not enabled (ocype = 0). otherwise timx_ccry shadow register is updated only at the ne xt update event. an example is given in figure 35 . figure 35. output compare mode, toggle on oc1 10.1.9 pwm mode pulse width modulation mode allows you to generate a signal with a frequency determined by the value of the timx_arr register, and a duty cycle determined by the value of the timx_ccry register. pwm mode can be selected independently on each channel (one pwm per ocy output) by writing 110 (pwm mode 1) or 111 (pwm mode 2) in the ocym bits in the timx_ccmr1 register. the corresponding buffer register must be enabled by setting the ocype bit in the timx_ccmr1 register. finally, in up-counting or center-aligned mode the auto-reload buffer register must be enabled by setting the arpe bit in the timx_cr1 register. because the buffer registers are only transfer red to the shadow registers when an update event occurs, before starting the counter initialize all the registers by setting the ug bit in the timx_egr register. ocy polarity is software programmable using the ccyp bit in the timx_ccer register. it can be programmed as active high or active low. ocy output is enabled by the ccye bit in the timx_ccer register. refer to the timx_ ccer register description in the registers section for more details. in pwm mode (1 or 2), timx_cnt and timx_ccry are always compared to determine whether timx_ccry timx_cnt or timx_cnt timx_ccry,depending on the direction of the counter. the ocyref signal is asserted only: ? when the result of the comparison changes, or ? when the output compare mode (ocym bits in the timx_ccmr1 register) switches from the "frozen" configuration (no comp arison, ocym = 000) to one of the pwm modes (ocym = 110 or 111). oc1ref=oc1 timx_cnt b200 b201 0039 timx_ccr1 003a write b201h in the timx_ccr1 register match detected on timx_ccr1 interrupt generated if enabled 003b b201 003a
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 178/285 docid16252 rev 15 this allows software to force a pwm output to a particular state while the timer is running. the timer is able to generate pwm in edge-aligned mode or center-aligned mode depending on the cms bits in the timx_cr1 register. pwm edge-aligned mode: up-counting configuration up-counting is active when the dir bit in the timx_cr1 register is low. refer to up- counting mode on page 163 . the following example uses pwm mode 1. the reference pwm signal ocyref is high as long as timx_cnt < timx_ccry, otherwise it becomes low. if the compare value in timx_ccry is greater than the auto-reload value in timx_arr, then ocyref is held at 1. if the compare value is 0, then ocyref is held at 0. figure 36 shows some edge-aligned pwm waveforms in an example, where timx_arr = 8. figure 36. edge-aligned pwm waveforms (arr = 8) pwm edge-aligned mode: down-counting configuration down-counting is active when the dir bit in the timx_cr1 register is high. refer to down- counting mode on page 165 for more information. in pwm mode 1, the reference signal ocyref is low as long as timx_cnt > timx_ccry, otherwise it becomes high. if the compare va lue in timx_ccry is greater than the auto- reload value in timx_arr, then oc yref is held at 1. zero-per cent pwm is not possible in this mode. pwm center-aligned mode center-aligned mode is active except when the cms bits in the timx_cr1 register are 00 (all configurations where cms is non-zero ha ve the same effect on the ocyref/ocy signals). the compare flag is set when the counter counts up, when it counts down, or when it counts up and down, depending on the cms bits configuration. the direction bit (dir) in the timx_cr1 register is updated by hardware and must not be changed by software. refer to center-aligned mode (up/down counting) on page 166 for more information. counter register ?1 0 1234567801 ?0 ocxref ccyie ocxref ccyie ocxref ocxref timx_ccry=4 timx_ccry=8 ccyie ccyie timx_ccry>8 timx_ccry=0
docid16252 rev 15 179/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 figure 37 shows some center-aligned pwm waveforms in an example where: ? timx_arr = 8, ? pwm mode is the pwm mode 1, ? the output compare flag is set when the c ounter counts down corresponding to the center-aligned mode 1 selected for cms = 01 in the timx_cr1 register. figure 37. center-aligned pwm waveforms (arr = 8) ccyie 012345678 765432101 counter register timx_ccry = 4 ocyref cms[1:0]=01 cms[1:0]=10 cms[1:0]=11 ccyie timx_ccry = 7 ocyref cms[1:0]=10 or 11 ccyie timx_ccry = 8 ocyref cms[1:0]=01 cms[1:0]=10 cms[1:0]=11 '1' ccyie timx_ccry > 8 ocyref cms[1:0]=01 cms[1:0]=10 cms[1:0]=11 '1' ccyie timx_ccry = 0 ocyref cms[1:0]=01 cms[1:0]=10 cms[1:0]=11 '0' ai14681c
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 180/285 docid16252 rev 15 hints on using center-aligned mode: ? when starting in center-aligned mode, the current up-down configuration is used. this means that the counter counts up or down d epending on the value written in the dir bit in the timx_cr1 register. the dir and cm s bits must not be changed at the same time by the software. ? writing to the counte r while running in center-aligned mode is not recommended as it can lead to unexpected results. in particular: ? the direction is not updated the value writte n to the counter that is greater than the auto-reload value (timx_cnt > timx_arr). for example, if the counter was counting up, it continues to count up. ? the direction is updated if when 0 or the ti mx_arr value is written to the counter, but no update event is generated. ? the safest way to use center-aligned mode is to generate an update by software (setting the ug bit in the timx_egr register) just before starting the counter, and not to write the counter wh ile it is running. 10.1.10 one-pulse mode one-pulse mode (opm) is a special case of the previous modes. it allows the counter to be started in response to a stimulus and to ge nerate a pulse with a programmable length after a programmable delay. starting the counter can be controlled through the slave mode controller. generating the waveform can be done in output compare mode or pwm mode. select opm by setting the opm bit in the timx_cr1 register. this makes the counter stop automatically at the next update event. a pulse can be correctly generated only if the compare value is different from the counter initial value. before starting (when the timer is waiting for the trigger) , the configuration must be: ? in up-counting: timx_cnt < timx_ccry timx_arr (in particular, 0 < timx_ccry), ? in down-counting: ti mx_cnt > timx_ccry.
docid16252 rev 15 181/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 figure 38. example of one pulse mode for example, to generate a positive pulse on oc1 with a length of tpulse and after a delay of tdelay as soon as a rising edge is detected on the ti2 inpu t pin, using ti2fp2 as trigger 1: ? map ti2fp2 on ti2 by writing ic2s = 01 in the timx_ccmr1 register. ? ti2fp2 must detect a rising edge. writ e cc2p = 0 in the timx_ccer register. ? configure ti2fp2 as trigger for the slave mode controller (trgi) by writing ts = 110 in the timx_smcr register. ? ti2fp2 is used to start the counter by wr iting sms to 110 in the timx_smcr register (trigger mode). ? the opm waveform is defined: write the co mpare registers, taking into account the clock frequency and the counter prescaler. the t delay is defined by the value written in the timx_ccr1 register. the tpulse is defined by the difference be tween the auto-reload value and the compare value (timx_arr - timx_ccr1). to build a waveform with a transition from 0 to 1 when a compare match occurs and a transition from 1 to 0 when the counter reaches the auto-reload value, enable pwm mode 2 by writing oc1m = 111 in the timx_ccmr1 regi ster. optionally, enable the buffer registers by writing oc1pe = 1 in the timx_ccmr1 regi ster and arpe in the timx_cr1 register. in this case, also write the compare value in t he timx_ccr1 register, the auto-reload value in the timx_arr register, generate an update by setting the ug bit, and wait for external trigger event on ti2. cc1p is written to 0 in this example. in the example, the dir and cms bits in the timx_cr1 register should be low. since only one pulse is desired, software should set the opm bit in the timx_cr1 register to stop the counter at the next update event (when the counter rolls over from the auto- reload value back to 0).
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 182/285 docid16252 rev 15 a special case: ocy fast enable in one-pulse mode, the edge detection on the tiy input sets the cen bit, which enables the counter. then the comparison between the counter and the compare value toggles the output. however, several clock cycles are needed for this operation, and it limits the minimum delay (tdelay min) achievable. to output a waveform with the minimum dela y, set the ocyfe bit in the timx_ccmr1 register. then ocyref (and ocy) is forced in response to the stimulus, without taking the comparison into account. its new level is the same as if a compare match had occurred. ocyfe acts only if the channel is configured in pwm mode 1 or 2. 10.1.11 encoder interface mode to select encoder interface mode, write sms = 001 in the timx_smcr register to count only ti2 edges, sms = 010 to count only ti1 edges, and sms = 011 to count both ti1 and ti2 edges. select the ti1 and ti2 polarity by programming the cc1p and cc2p bits in the timx_ccer register. if needed, program the input filter as well. the two inputs ti1 and ti2 are used to interface to an incremental encoder (see table 34 ). assuming that it is enabled, (t he cen bit in the timx_cr1 regi ster written to 1) the counter is clocked by each valid transition on ti1fp1 or ti2fp2 (ti1 and ti2 after input filter and polarity selection, ti1fp1 = ti1 if not filtered and not inverted, ti2fp2 = ti2 if not filtered and not inverted.) the sequence of transitions of the two inputs is evaluated, and generates count pulses as well as the direction signal. depending on the sequence, the counter counts up or down, and hardware modifies the dir bit in the timx_cr1 register accordingly. the dir bit is calculated at each transition on any input (ti1 or ti2), whether the counter is counting on ti1 only, ti2 only, or both ti1 and ti2. encoder interface mode acts simply as an ex ternal clock with direction selection. this means that the counter just counts continuous ly between 0 and the auto-reload value in the timx_arr register (0 to timx_arr or timx_a rr down to 0 depending on the direction), so timx_arr must be configured before starti ng. in the same way, the capture, compare, prescaler, and trigger output featur es continue to work as normal. in this mode the counter is modified automati cally following the speed and the direction of the incremental encoder, and therefore its co ntents always represent t he encoder's position. the count direction corresponds to the rota tion direction of th e connected sensor. table 34 summarizes the possible combinations, assuming ti1 and ti2 do not switch at the same time.
docid16252 rev 15 183/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 an external incremental encoder can be conn ected directly to the mcu without external interface logic. however, comparators are normally used to convert an encoder's differential outputs to digital signals, and this greatly incr eases noise immunity. if a third encoder output indicates the mechanical zero (or index) position, it may be connected to an external interrupt input and can trigger a counter reset. figure 39 gives an example of counter operation , showing count signal generation and direction control. it also shows how input ji tter is compensated for when both inputs are used for counting. this might occur if the se nsor is positioned near one of the switching points. this example assumes the following configuration: ? cc1s = 01 (timx_ccmr1 register, ic1fp1 mapped on ti1). ? cc2s = 01 (timx_ccmr2 register, ic2fp2 mapped on ti2). ? cc1p = 0 (timx_ccer register, ic1fp1 non-inverted, ic1fp1 = ti1). ? cc2p = 0 (timx_ccer register, ic2fp2 non-inverted, ic2fp2 = ti2). ? sms = 011 (timx_smcr register, both inputs are active on both rising and falling edges). ? cen = 1 (timx_cr1 register, counter is enabled). figure 39. example of counter operation in encoder interface mode table 34. counting directi on versus encoder signals active edges level on opposite signal (ti1fp1 for ti2, ti2fp2 for ti1) ti1fp1 signal ti2fp2 signal rising falling rising falling counting on ti1 only high down up no count no count low up down no count no count counting on ti2 only high no count no count up down low no count no count down up counting on ti1 and ti2 high down up up down low up down down up
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 184/285 docid16252 rev 15 figure 40 gives an example of counter behavior wh en ic1fp1 polarity is inverted (same configuration as above except cc1p = 1). figure 40. example of encoder interface mode with ic1fp1 polarity inverted the timer configured in encoder interface mode provides information on a sensor's current position. to obtain dynamic information (sp eed, acceleration/deceleration), measure the period between two encoder events using a second timer configured in capture mode. the output of the encoder that indicates the me chanical zero can be used for this purpose. depending on the time between two events, the counter can also be read at regular times. do this by latching the counter value into a th ird input capture register. (in this case the capture signal must be periodic and can be generated by another timer). 10.1.12 timer input xor function the ti1s bit in the tim1_cr2 register allows th e input filter of channel 1 to be connected to the output of a xor gate that combines the three input pins timxc2 to timxc4. the xor output can be used with all the timer input functions such as trigger or input capture. it is especially useful to interface to hall effect sensors.
docid16252 rev 15 185/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.1.13 timers and external trigger synchronization the timers can be synchronized with an external trigger in several modes: reset mode, gated mode, and trigger mode. slave mode: reset mode reset mode reinitializes the coun ter and its prescaler in response to an event on a trigger input. moreover, if the urs bit in the timx_ cr1 register is low, an update event is generated. then all the buffered regist ers (timx_arr, timx_ccry) are updated. in the following example, the up -counter is cleared in response to a rising edge on the ti1 input: ? configure the channel 1 to detect rising edges on ti1: configure the input filter duration. in this example, no filter is requ ired so ic1f = 0000. the capture prescaler is not used for triggering, so it is not configured. the cc1s bits select the input capture source only, cc1s = 01 in the timx_c cmr1 register. write cc1p = 0 in the timx_ccer register to validate the polarity, and detect rising edges only. ? configure the timer in reset mode by writ ing sms = 100 in the timx_smcr register. select ti1 as the input source by writ ing ts = 101 in the timx_smcr register. ? start the counter by writing cen = 1 in the timx_cr1 register. the counter starts counting on the internal clock, then behaves normally until the ti1 rising edge. when ti1 rises, the counter is cleared and restarts from 0. in the meantime, the trigger flag is set (the tie bit in the timx_sr register) and an interrupt request can be sent if enabled (depending on the tie bi t in the timx_ier register). figure 41 shows this behavior when the auto-reload register timx_arr = 0x36. the delay between the rising edge on ti1 and the actual reset of the counter is due to the resynchronization circuit on the ti1 input. figure 41. control circuit in reset mode 00 counter clock = ck_cnt = ck_psc counter register 01 02 03 00 01 02 03 32 33 34 35 36 ug ti1 31 30 tie
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 186/285 docid16252 rev 15 slave mode: gated mode in gated mode the counter is enabled depending on the level of a selected input. in the following example, the up-counter counts only when the ti1 input is low: ? configure channel 1 to detect low levels on ti1 configure the input filter duration. in this example, no filter is required, so ic1f = 0000. the capture prescaler is not used for triggering, so it is not configured. the cc1s bits select the input capture source only, cc1s = 01 in the timx_ccmr1 register. write cc1p = 1 in the timx_ccer register to validate the polarity (and detect low level only). ? configure the timer in gated mode by writ ing sms = 101 in the timx_smcr register. select ti1 as the input source by writ ing ts = 101 in the timx_smcr register. ? enable the counter by writing cen = 1 in the timx_cr1 register. in gated mode, the counter does not start if cen = 0, regardless of the trigger input level. the counter starts counting on the internal cloc k as long as ti1 is low and stops as soon as ti1 becomes high. the tie flag in the timx_sr register is set when the counter starts and when it stops. the delay between the rising edge on ti1 and t he actual stop of the counter is due to the resynchronization circuit on the ti1 input. figure 42. control circuit in gated mode counter clock = ck_cnt = ck_psc counter register 35 36 37 38 32 33 34 ti1 31 30 cnt_en tie clear tie
docid16252 rev 15 187/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 slave mode: trigger mode in trigger mode the counter starts in response to an event on a selected input. in the following example, the up-counter starts in response to a rising edge on the ti2 input: ? configure channel 2 to detect rising edges on ti2 configure the input filter duration. in this example, no filter is required so ic2f = 0000. the capture prescaler is not used for triggering, so it is not configured. the cc2s bits select the input capture source only, cc2s = 01 in the timx_ccmr1 register. write cc2p = 0 in the timx_ccer register to validate the polarity and detect high level only. ? configure the timer in trigger mode by writing sms = 110 in the timx_smcr register. select ti2 as the input source by writ ing ts = 110 in the timx_smcr register. when a rising edge occurs on ti2, the counter starts counting on the internal clock and the tie flag is set. the delay between the rising edge on ti2 and t he actual start of the counter is due to the resynchronization circuit on the ti2 input. figure 43. control circuit in trigger mode counter clock = ck_cnt = ck_psc counter register 35 36 37 38 34 ti2 cnt_en tie
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 188/285 docid16252 rev 15 slave mode: external clock mode 2 + trigger mode external clock mode 2 can be used in combi nation with another slave mode (except external clock mode 1 and encoder mode). in this case, the etr signal is used as external clock input, and another input can be selected as trigger input when operating in reset mode, gated mode or trigger mode. it is not recomme nded to select etr as trgi through the ts bits of timx_smcr register. in the following example, the up-counter is incremented at each rising edge of the etr signal as soon as a risi ng edge of ti1 occurs: ? configure the external trigger input circuit by programming the timx_smcr register as follows: ? etf = 0000: no filter. ? etps = 00: prescaler disabled. ? etp = 0: detection of rising edges on etr and ece = 1 to enable the external clock mode 2. ? configure the channel 1 as follows, to detect rising edges on ti: ? ic1f = 0000: no filter. ? the capture prescaler is not used for triggering and does not need to be configured. ? cc1s = 01in the timx_ccmr1 register to select only the input capture source. ? cc1p = 0 in the timx_ccer register to validate the polarity (and detect rising edge only). ? configure the timer in trigger mode by writing sms = 110 in the timx_smcr register. select ti1 as the input source by writ ing ts = 101 in the timx_smcr register. a rising edge on ti1 enables the counter and sets the tie flag. the counter then counts on etr rising edges. the delay between the rising edge of the etr signal and the actual reset of the counter is due to the resynchronization circuit on etrp input. figure 44. control circuit in external clock mode 2 + trigger mode counter clock = ck_cnt = ck_psc counter register 35 36 34 etr cen/cnt_en tie ti1
docid16252 rev 15 189/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.1.14 timer synchronization the two timers can be linked together interna lly for timer synchronization or chaining. a timer configured in master mode can reset, start, stop or clock the counter of the other timer configured in slave mode. figure 45 presents an overview of the trigger selection and the master mode selection blocks. using one timer as prescaler for the other timer for example, to configure timer 1 to act as a prescaler for timer 2 (see figure 45 ): ? configure timer 1 in master mode so that it outputs a periodic trigger signal on each update event. writing mms = 010 in the tim1_c r2 register causes a rising edge to be output on trgo each time an update event is generated. ? to connect the trgo output of timer 1 to timer 2, configure timer 2 in slave mode using itr0 as an internal tr igger. select this through th e ts bits in the tim2_smcr register (writing ts = 000). ? put the slave mode controller in external clock mode 1 (write sms = 111 in the tim2_smcr register). this ca uses timer 2 to be clocked by the rising edge of the periodic timer 1 trigger signal (which co rresponds to the timer 1 counter overflow). ? finally both timers must be enabled by setting their respective cen bits (timx_cr1 register). note: if ocy is selected on timer 1 as trigger output (mms = 1xx), its rising edge is used to clock the counter of timer 2. figure 45. master/slave timer example trgo1 uev itr1 prescaler counter sms ts mms timer 1 timer 2 master mode control slave mode control ck_psc prescaler counter clock input selection trigger
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 190/285 docid16252 rev 15 using one timer to enable the other timer in this example, the enable of timer 2 is co ntrolled with the output compare 1 of timer 1. refer to figure 45 for connections. timer 2 counts on th e divided internal clock only when oc1ref of timer 1 is high. both counter clock frequencies are divided by 3 by the prescaler compared to ck_int (fck_cnt = fck_int /3). ? configure timer 1 in master mode to send its output compare reference (oc1ref) signal as trigger output (mms = 100 in the tim1_cr2 register). ? configure the timer 1 oc1ref wa veform (tim1_ccm r1 register). ? configure timer 2 to get the input trigger from timer 1 (ts = 000 in the tim2_smcr register). ? configure timer 2 in gated mode (sms = 101 in the tim2_smcr register). ? enable timer 2 by wr iting 1 in the cen bi t (tim2_cr1 register). ? start timer 1 by writing 1 in the cen bit (tim1_cr1 register). note: the counter 2 clock is not synchronized with counter 1, this mode only affects the timer 2 counter enable signal. figure 46. gating timer 2 with oc1ref of timer 1 in the example in figure 46 , the timer 2 counter and prescaler are not initialized before being started. so they start counting from their current value. it is po ssible to start from a given value by resetting both timers before star ting timer 1, then writing the desired value in the timer counters. the timers can easily be reset by software using the ug bit in the timx_egr registers. tie write tie=0 fc fd fe ff 00 3 045 3 047 3 04 8 ck_int timer1-oc1ref tim1-cnt tim2-cnt 01 3 046
docid16252 rev 15 191/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 the next example, synchronizes timer 1 and timer 2. timer 1 is the master and starts from 0. timer 2 is the slave and starts from 0xe7. the prescaler ratio is the same for both timers. timer 2 stops when timer 1 is disabled by writing 0 to the cen bit in the tim1_cr1 register: ? configure timer 1 in master mode to send its output compare reference (oc1ref) signal as trigger output (mms = 100 in the tim1_cr2 register). ? configure the timer 1 oc1ref wa veform (tim1_ccm r1 register). ? configure timer 2 to get the input trigger from timer 1 (ts = 000 in the tim2_smcr register). ? configure timer 2 in gated mode (sms = 101 in the tim2_smcr register). ? reset timer 1 by writing 1 in the ug bit (tim1_egr register). ? reset timer 2 by writing 1 in the ug bit (tim2_egr register). ? initialize timer 2 to 0xe7 by writing 0xe7 in the ti mer 2 counter (tim2_cntl). ? enable timer 2 by wr iting 1 in the cen bi t (tim2_cr1 register). ? start timer 1 by writing 1 in the cen bit (tim1_cr1 register). ? stop timer 1 by writing 0 in the cen bit (tim1_cr1 register). figure 47. gating timer 2 with enable of timer 1 tie clear tie 75 00 01 ck_int tim1_cr1 cen=1 tim2-cnt 02 tim1_cnt ab 00 e7 e 8 e9 timer2-cnt_init timer2 write cnt[15:0] timer1-cnt_init
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 192/285 docid16252 rev 15 using one timer to start the other timer in this example, the enable of timer 2 is set with the update event of timer 1. refer to figure 45 for connections. timer 2 starts counting from its current value (which can be non- zero) on the divided internal clock as so on as timer 1 generates the update event. when timer 2 receives the trigger signal its cen bit is automatically set and the counter counts until 0 is written to the cen bit in the tim2_cr1 register. both counter clock frequencies are divided by 3 by the pres caler compared to ck_int (fck_cnt = fck_int/3). ? configure timer 1 in master mode to send its update event as trigger output (mms = 010 in the tim1_cr2 register). ? configure the timer 1 period (tim1_arr register). ? configure timer 2 to get the input trigger from timer 1 (ts = 000 in the tim2_smcr register). ? configure timer 2 in trigger mode (sms = 110 in the tim2_smcr register). ? start timer 1: write 1 in the cen bit (tim1_cr1 register). figure 48. triggering timer 2 with update of timer 1 as in the previous example, both counters can be initialized before starting counting. figure 47 shows the behavior with the same configuration shown in figure 48 , but in trigger mode instead of gated mode (sms = 110 in the tim2_smcr register). tie clear tie fd fe ff 00 01 45 47 4 8 ck_int timer1-uev tim1-cnt tim2-cnt 02 46 tim2_cr1 cen=1
docid16252 rev 15 193/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 figure 49. triggering timer 2 with enable of timer 1 starting both timers synchronously in response to an external trigger this example, sets the enable of timer 1 when its ti1 input rises, and the enable of timer 2 with the enable of timer 1. refer to figure 45 for connections. to ensure the counters are aligned, timer 1 must be configured in master/sla ve mode (slave with respect to ti1, master with respect to timer 2): ? configure timer 1 in master mode to send its enable as trigger output (mms = 001 in the tim1_cr2 register). ? configure timer 1 slave mode to get the input trigger from ti1 (ts = 100 in the tim1_smcr register). ? configure timer 1 in trigger mode (sms = 110 in the tim1_smcr register). ? configure the timer 1 in master/slave mode by writing msm = 1 (tim1_smcr register). ? configure timer 2 to get the input trigger from timer 1 (ts = 000 in the tim2_smcr register). ? configure timer 2 in trigger mode (sms = 110 in the tim2_smcr register). when a rising edge occurs on ti1 (timer 1), both counters start counting synchronously on the internal clock and both timers' tie flags are set. note: in this example both timers are initialized before starting by setting their respective ug bits. both counters starts from 0, but an offset can be inserted between them by writing any of the counter registers (timx_cnt). the master/s lave mode inserts a delay between cnt_en and ck_psc on timer 1. tie clear tie 75 00 01 ck_int tim1_cr1 cen=1 tim1_cnt tim2-cnt 02 timer1-cnt_init cd 00 e7 e 8 ea timer2-cnt_init timer2 write cnt[15:0] e9
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 194/285 docid16252 rev 15 figure 50. triggering timers 1 and 2 with timer 1 ti1 input 00 01 ck_int tim1_cr1 cen=1 tim1-cnt timer 1-ti1 timer 1-ck_p s c 02 0 3 04 05 06 07 0 8 09 tie 00 01 tim2_cr1 cen=1 tim2_cnt timer 2-ck_p s c 02 0 3 04 05 06 07 0 8 09 tie
docid16252 rev 15 195/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.1.15 timer signal descriptions table 35. timer signal descriptions signal internal/external description ck_int internal internal clock source: connects to stm32w108 peripheral clock (pclk) in internal clock mode. ck_psc internal input to the clock prescaler. etr internal external trigger input (used in external timer mode 2): a clock selected by extri gsel in timx_or. etrf internal external trigger: etrp after filtering. etrp internal external trigger: etr after polarity selection, edge detection and prescaling. icy external input capture or clock: tiy after filtering and edge detection. icyps internal input capture signal after f iltering, edge detection and prescaling: input to the capture register. itr0 internal internal trigger input: connected to the other timer's output, trgo. ocy external output compare: timxcy when used as an output. same as ocyref but includes possible polarity inversion. ocyref internal output compare reference: a lways active high, but may be inverted to produce ocy. pclk external peripheral clock connects to ck_int and used to clock input filtering. its frequency is 12 mhz if using the 24 mhz hse osc and 6 mhz if using the 12 mhz hsi rc oscillator. tiy internal timer input: timxcy when used as a timer input. tiyfpy internal timer input after filtering and polarity selection. timxcy internal timer channel at a gpio pin: can be a capture input (icy) or a compare output (ocy). timxclk external clock input (if selected) to the external trigger signal (etr). timxmsk external clock mask (if enabled) and'ed with the other timer's timxclk signal. trgi internal trigger input for slave mode controller.
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 196/285 docid16252 rev 15 10.2 interrupts several kinds of timer events can generate a timer interrupt, and each has a status flag in the timx_sr register to identify the reason(s) for the interrupt: ? tie - set by a rising edge on an external trigger, either edge in gated mode ? ccyif - set by a channel y input capture or output compare event ? uif - set by an update event clear bits in timx_sr by writing a 1 to their bi t position. when a channel is in capture mode, reading the timx_ccry register will also clear the ccyif bit. the timx_ier register controls whether or not the timx_sr bi ts actually request an arm? cortex-m3 timer interrupt. only the events whose bits are set to 1 in timx_ier can do so. if an input capture or output compare event occurs and its ccyim is already set, the corresponding capture/compare missed flag is se t in the timx_missr register. clear a bit in the timx_missr register by writing a 1 to it. 10.3 general-purpose ti mers 1 and 2 registers 10.3.1 timer x interrupt and status register (timx_isr) address offset: 0xa800 (tim1) and 0xa804 (tim2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved rsvd[3:0] reserved tif reserved cc4if cc3if cc2if cc1if uif rrr r rw rwrwrwrwrw bits 31:13] reserved, must be kept at reset value bits 12:9] rsvd[3:0]: may change during normal operation bits 8:7] reserved, must be kept at reset value bit 6 tif: trigger interrupt bit 5 reserved, must be kept at reset value bit 4 cc4if: capture or compare 4 interrupt pending bit 3 cc3if: capture or compare 3 interrupt pending bit 2 cc2if: capture or compare 2 interrupt pending bit 1 cc1if: capture or compare 1 interrupt pending bit 0 uif: update interrupt pending
docid16252 rev 15 197/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.3.2 timer x interrupt missed re gister (timx_missr) address offset: 0xa818 (tim1) and 0xa81c (tim2) reset value: 0x0000 0000 10.3.3 timer x interrupt enable register (timx_ier) address offset: 0xa840 (tim1) and 0xa844 (tim2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved cc4im cc3im cc2im cc1im reserved rsvd[6:0] rw rw rw rw r r r r r r r bits 31:13] reserved, must be kept at reset value bit 12 cc4im: capture or compare 4 interrupt missed bit 11 cc3im: capture or compare 3 interrupt missed bit 10 cc2im: capture or compare 2 interrupt missed bit 9 cc1im: capture or compare 1 interrupt missed bits 8:7] reserved, must be kept at reset value bits 6:0] rsvd[6:0]: may change during normal operation 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved tie reserved cc4ie cc3ie cc2ie cc1ie uie rw rw rw rw rw rw bits 31:7] reserved, must be kept at reset value bit 6 tie: trigger interrupt enable bit 4 cc4ie: capture or compare 4 interrupt enable bit 3 cc3ie: capture or compare 3 interrupt enable bit 2 cc2ie: capture or compare 2 interrupt enable bit 1 cc1ie: capture or compare 1 interrupt enable bit 0 uie: update interrupt enable
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 198/285 docid16252 rev 15 10.3.4 timer x control register 1 (timx_cr1) address offset: 0xe000 (tim1) and 0xf000 (tim2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved arpe cms[1:0] dir opm urs udis cen rw rw rw rw rw rw rw rw bits 31:8] reserved, must be kept at reset value bit 7 arpe: auto-reload preload enable 0: timx_arr register is not buffered 1: timx_arr register is buffered bits 6:5] cms[1:0]: center-aligned mode selection 00: edge-aligned mode. the counter counts up or down depending on the direction bit (dir). 01: center-aligned mode 1. the counte r counts up and down alternatively. output compare interrupt flags of config ured output channels (ccy s=00 in timx_ccmry register) are set only when the counter is counting down. 10: center-aligned mode 2. the counte r counts up and down alternatively. output compare interrupt flags of config ured output channels (ccy s=00 in timx_ccmry register) are set only when the counter is counting up. 11: center-aligned mode 3. the counter counts up and down alternatively. output compare interrupt flags of config ured output channels (ccy s=00 in timx_ccmry register) are set both when the counter is counting up or down. note: software may not switch from edge-aligned mode to center-aligned mode when the counter is enabled (cen=1). bit 4 dir: direction 0: counter used as up-counter 1: counter used as down-counter bit 3 opm: one pulse mode 0: counter does not stop count ing at the next update event. 1: counter stops counting at the next update event (and clears the bit cen). bit 2 urs: update request source 0: when enabled, update interrupt requests are sent as soon as registers are updated (counter overflow/underflow, se tting the ug bit, or update generation through the slave mode controller). 1: when enabled, update interrupt requests are sent only when the counter reaches overflow or underflow.
docid16252 rev 15 199/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 bit 1 udis: update disable 0: an update event is generated as soon as a c ounter overflow occurs, a software update is generated, or a hardware reset is generated by the slave mode controller. shadow registers are then loaded with their buffer register values. 1: an update event is not generated and sha dow registers keep their value (timx_arr, timx_psc, timx_ccry). the counter and the prescaler are reinit ialized if the ug bit is set or if a hardware reset is received from the slave mode controller. bit 0 cen: counter enable 0: counter disabled 1: counter enabled note: external clock, gated mode and encoder mode can work only if the cen bit has been previously set by software. trigger mode sets the cen bit automatically through hardware.
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 200/285 docid16252 rev 15 10.3.5 timer x control register 2 (timx_cr2) address offset: 0xe004 (tim1) and 0xf004 (tim2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved ti1s mms[2:0] reserved rw rw rw rw bits 31:8 reserved, must be kept at reset value bit 7 ti1s: ti1 selection 0: ti1m (input of the digital f ilter) is connected to ti1 input. 1: ti1m is connected to the ti _hall inputs (xor combination). bits 6:4 mms[2:0]: master mode selection this selects the information to be sent in master mode to a slave timer for synchronization using the trigger output (trgo). 000: reset - the ug bit in the timx_egr register is trigger output. if the reset is generated by the trigger input (s lave mode controller configured in reset mode), then the signal on trgo is delayed compared to the actual reset. 001: enable - counter enable si gnal cnt_en is trigger output. this mode is used to start both timers at the same time or to control a window in which a slave timer is enabled. the counter enable signal is generated by either the cen control bit or the trigger input when configured in gated mode. when the counter enable signal is controlled by the trigger input there is a delay on trgo except if the master/slave mode is selected (see the msm bit description in timx_smcr register). 010: update - update ev ent is trigger output this mode allows a master timer to be a prescaler for a slave timer. 011: compare pulse the trigger output sends a positive pulse when the cc1if flag is to be set (even if it was already high) as soon as a capture or a compare match occurs. 100: compare - oc1ref signal is trigger output 101: compare - oc2ref signal is trigger output 110: compare - oc3ref signal is trigger output 111: compare - oc4ref signal is trigger output bits 3:0] reserved, must be kept at reset value
docid16252 rev 15 201/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.3.6 timer x slave mode control register (timx_smcr) address offset: 0xe008 (tim1) and 0xf008 (tim2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 etp ece etps[1:0] etf[3:0] msm ts[2:0] reserved sms[2:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bit 15 etp: external trigger polarity this bit selects whether etr or the inverse of etr is used for trigger operations. 0: etr is non-inverted, active at a high level or rising edge 1: etr is inverted, active at a low level or falling edge bit 14 ece: external clock enable this bit enables external clock mode 2. 0: external clock mode 2 disabled 1: external clock mode 2 enabled. the counter is clocked by any active edge on the etrf signal. note: setting the ece bit has the same effect as selecting external clock mode 1 with trgi connected to etrf (sms=111 and ts=111). it is possible to use this mode simultaneously with the following slave modes: reset mode, gat ed mode and trigger mode. trgi must not be connected to etrf in this case (the ts bits must not be 111). if external clock mode 1 and external clock mode 2 are enabled at the same time, the external clock input will be etrf. bits 13:12 etps[1:0]: external trigger prescaler external trigger signal etrp frequency must be at most 1/4 of ck frequency. a prescaler can be enabled to reduce etrp frequency. it is useful with fast external clocks. 00: etrp prescaler off 01: divide etrp frequency by 2 10: divide etrp frequency by 4 11: divide etrp frequency by 8
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 202/285 docid16252 rev 15 bits 11:8 etf[3:0]: external trigger filter this defines the frequency used to sample the etrp signal, f sampling , and the length of the digital filter applied to etrp. the digital filter is made of an event counter in which n events are needed to validate a transition on the output: 0000: f sampling = pclk, no filtering 0001: f sampling = pclk, n=2 0010: f sampling = pclk, n=4 0011: f sampling = pclk, n=8 0100: f sampling = pclk/2, n= 0101: f sampling = pclk/2, n=8 0110: f sampling = pclk/4, n=6 0111: f sampling = pclk/4, n=8 1111: f sampling = pclk/32, n=8 1110: f sampling = pclk/32, n=6 1101: f sampling = pclk/32, n=5 1100: f sampling = pclk/16, n=8 1011: f sampling = pclk/16, n=6 1010: f sampling = pclk/16, n=5 1001: f sampling = pclk/8, n=8 1000: f sampling = pclk/8, n=6 note: pclk is 12 mhz when the stm32w108 is using the 24 mhz hse osc, and 6 mhz if using the 12 mhz hsi rc oscillator. bit 7 msm: master/slave mode 0: no action 1: the effect of an event on the trigger input (trgi) is delayed to allow exact synchronization between the current timer and the slave (through tr go). it is useful fo r synchronizing timers on a single external event. bits 6:4 ts[2:0]: trigger selection this bit field selects the trigger input used to synchronize the counter. 000: internal trigger 0 (itr0) 100: ti1 edge detector (ti1f_ed) 101: filtered timer input 1 (ti1fp1) 110: filtered timer input 2 (ti2fp2) 111: external trigger input (etrf) note: these bits must be changed only when they are not used (when sms=000) to avoid detecting spurious edges during the transition. bit 3 reserved, must be kept at reset value
docid16252 rev 15 203/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 bits 2:0 sms[2:0]: slave mode selection when external signals are selected the active edge of the trigger signal (trgi) is linked to the polarity selected on the external input. 000: slave mode disabled. if cen = 1 then the prescaler is clo cked directly by the internal clock. 001: encoder mode 1. counter counts up/down on ti1fp1 edge depending on ti2fp2 level. 010: encoder mode 2. counter counts up/down on ti2fp2 edge depending on ti1fp1 level. 011: encoder mode 3. counter counts up/down on both ti1fp1 and ti2fp2 edges depending on the level of the other input. 100: reset mode. rising edge of the selected trig ger signal (trgi) >reinitializes the counter and generates an update of the registers. 101: gated mode. the counter clock is enabled when the trigger signal (trgi) is high. the counter stops (but is not reset) as soon as the trigger becomes low. both starting and stopping the counter are controlled. 110: trigger mode. the counter starts at a rising edge of the trigger trgi (but it is not reset). only starting the counter is controlled. 111: external clock mode 1. rising edges of the selected trigger (trgi) clock the counter. note: gated mode must not be used if ti1f_e d is selected as the trigger input (ts=100). ti1f_ed outputs 1 pulse for each transition on ti1f, whereas gate d mode checks the level of the trigger signal.
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 204/285 docid16252 rev 15 10.3.7 timer x event generation register (timx_egr) address offset: 0xe014 (tim1) and 0xf014 (tim2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved tg reserved cc4g cc3g cc2g cc1g ug wwwwww bits 31:7 reserved, must be kept at reset value bit 6 tg: trigger generation 0: does nothing 1: sets the tim_tif flag in the timx_sr register bit 5 reserved, must be kept at reset value bit 4 cc4g: capture/compare 4 generation 0: does nothing 1: if cc4 configured as output channel, the cc4if flag is set. if cc4 configured as input channel, the cc4if flag is set. the cc4im flag is set if the cc4if flag was already high. the current value of the counter is captured in timx_ccr4 register. bit 3 cc3g: capture/compare 3 generation 0: does nothing 1: if cc3 configured as output channel, the cc3if flag is set. if cc3 configured as input channel, the cc3if flag is set. the cc3im flag is set if the cc3if flag was already high. the current value of the counter is captured in timx_ccr3 register. bit 2 cc2g: capture/compare 2 generation 0: does nothing 1: if cc2 configured as output channel, the cc2if flag is set. if cc2 configured as input channel, the cc2if flag is set. the cc2im flag is set if the cc2if flag was already high. the current value of the counter is captured in timx_ccr2 register. bit 1 cc1g: capture/compare 1 generation 0: does nothing 1: if cc1 configured as output channel, the cc1if flag is set. if cc1 configured as input channel, the cc1if flag is set. the cc1im flag is set if the cc1if flag was already high. the current value of the counter is captured in timx_ccr1 register. bit 0 ug: update generation 0: does nothing 1: re-initializes the counter and generates an update of the registers. this also clears the prescaler counter but the prescaler ratio is no t affected. the counter is cleared if center- aligned mode is selected or if dir=0 (up-coun ting), otherwise it takes the auto-reload value (tim1_arr) if dir=1 (down-counting).
docid16252 rev 15 205/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.3.8 timer x capture/compare mode register 1 (timx_ccmr1) address offset: 0xe018 (tim1) and 0xf018 (tim2) reset value: 0x0000 0000 the timer channels can be programmed as inputs (capture mode) or outputs (compare mode). the direction of a channel ?y? is defi ned by configuring the corresponding ccys bits in this register. all other bits have different functions in input and in output mode. for a given bit: ? ocxy describes its function when the channel is configured as an output (ccys = 0) ? icxy describes its function when the channel is configured as an input (ccys > 0) in short, the same bit can have a different meaning for the input stage and for the output stage. care should be taken. output compare mode 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved oc2m[2:0] oc2pe oc2fe cc2s[1:0] reserved oc1m[2:0] oc1pe oc1fe cc1s[1:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:15 reserved, must be kept at reset value bits 14:12 oc2m[2:0]: output compare 2 mode defines the behavior of the output reference signal oc2ref from which oc2 derives. oc2ref is active high whereas oc2''s active level depends on the cc2p bit. 000: frozen - the comparison between the output compare register timx_ccr2 and the counter timx_cnt has no effect on the outputs. 001: set oc2ref to active on match. the oc2ref signal is forced high when the counter timx_cnt matches the capture/compare register 2 (timx_ccr2). 010: set oc2ref to inactive on match. oc2ref signal is forced low when the counter timx_cnt matches the capture/compare register 2 (timx_ccr2). 011: toggle - oc2ref toggles when timx_cnt = timx_ccr2 100: force oc2ref inactive 101: force oc2ref active 110: pwm mode 1 - in up-counting, oc2ref is active as long as timx_cnt < timx_ccr2, otherwise oc2ref is inactive. in down -counting, oc2ref is inactive if timx_cnt > timx_ccr2, otherwise oc2ref is active. 111: pwm mode 2 - in up-counting, oc2ref is inactive if timx_cnt < timx_ccr2, otherwise oc2ref is active. in dow n-counting, oc2ref is active if timx_cnt > timx_ccr2, otherwise it is inactive. note: in pwm mode 1 or 2, the oc2ref level changes only when the result of the comparison changes or when the output compar e mode switches from ?frozen? mode to ?pwm? mode.
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 206/285 docid16252 rev 15 bit 11 oc2pe: output compare 2 preload enable 0: buffer register for timx_ccr2 is disabled. timx_ccr2 can be written at anytime, the new value is used by the shadow register immediately. 1: buffer register for timx_ccr2 is en abled. read/write operations access the buffer register. timx_ccr2 buffer value is loaded in the shadow register at each update event. note: the pwm mode can be used without enab ling the buffer register only in one pulse mode (opm bit set in the timx_cr2 regist er), otherwise the behavior is undefined. bit 10 oc2fe: output compare 2 fast enable this bit speeds the effect of an event on the trigger in input on the oc2 output. 0: oc2 behaves normally depending on the counter and ccr2 values even when the trigger is on. the minimum delay to activate oc2 when an edge occurs on the trigger input is 5 clock cycles. 1: an active edge on the trigger input acts li ke a compare match on the oc2 output. oc2 is set to the compare level independently from the result of the comparison. delay to sample the trigger input a nd to activate oc2 output is reduced to 3 cloc k cycles. oc2fe acts only if the channel is configured in pwm 1 or pwm 2 mode. bits 9:8 cc2s[1:0]: capture / compare 1 selection this configures the channel as an output or an input. if an input, it selects the input source. 00: channel is an output 01: channel is an input and is mapped to ti2 10: channel is an input and is mapped to ti1 11: channel is an input and is mapped to trgi. this mode requires an internal trigger input selected by the ts bit in the timx_smcr register. note: cc2s may be written only when the channel is off (cc2e = 0 in the timx_ccer register). bit 7 reserved, must be kept at reset value bits 6:4 oc1m[2:0]: ou tput compare 1 mode see oc2m description above bit 3 oc1pe: output compare 1 preload enable see oc2pe description above bit 2 oc1fe: output compare 1 fast enable see oc2fe description above bits 1:0 cc1s[1:0]: capture / compare 1 selection this configures the channel as an output or an input. if an input, it selects the input source. 00: channel is an output 01: channel is an input and is mapped to ti1 10: channel is an input and is mapped to ti2 11: channel is an input and is mapped to trgi. this requires an internal trigger input selected by the ts bit in the timx_smcr register. note: cc1s may be written only when the channel is off (cc1e = 0 in the timx_ccer register).
docid16252 rev 15 207/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 input capture mode 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ic2f[3:0] ic2psc[1:0] cc2s[1:0] ic1f[3:0] ic1psc[1:0] cc1s[1:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:12 ic2f[3:0]: input capture 1 filter this defines the frequency used to sample the ti 2 input, fsampling, and the length of the digital filter applied to ti2. the digital filter requires n consecutive samples in the same state before being output. 0000: fsampling=pclk, no filtering 0001: fsampling=pclk, n=2 0010: fsampling=pclk, n=4 0011: fsampling=pclk, n=8 0100: fsampling=pclk/2, n=6 0101: fsampling=pclk/2, n=8 0110: fsampling=pclk/4, n=6 0111: fsampling=pclk/4, n=8 1000: fsampling=pclk/8, n=6 1001: fsampling=pclk/8, n=8 1010: fsampling=pclk/16, n=5 1011: fsampling=pclk/16, n=6 1100: fsampling=pclk/16, n=8 1101: fsampling=pclk/32, n=5 1110: fsampling=pclk/32, n=6 1111: fsampling=pclk/32, n=8 note: pclk is 12 mhz when using the 24 mhz hse osc, and 6 mhz using the 12 mhz hsi rc oscillator. bits 11:10 ic2psc[1:0]: i nput capture 1 prescaler 00: no prescaling, capture each time an edge is detected on the capture input 01: capture once every 2 events 10: capture once every 4 events 11: capture once every 6 events bits 9:8 cc2s[1:0]: capture / compare 1 selection this configures the channel as an output or an input. if an input, it selects the input source. 00: channel is an output 01: channel is an input and is mapped to ti2 10: channel is an input and is mapped to ti1 11: channel is an input and is mapped to trgi. this mode requires an internal trigger input selected by the ts bit in the timx_smcr register. note: cc2s may be written only when the channel is off (cc2e = 0 in the timx_ccer register).
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 208/285 docid16252 rev 15 bits 7:4 ic1f[3:0]: input capture 1 filter see ic2f description above bits 3:2 ic1psc[1:0]: i nput capture 1 prescaler see ic2psc description above bits 1:0 cc1s[1:0]: capture / compare 1 selection this configures the channel as an output or an input. if an input, it selects the input source. 00: channel is an output 01: channel is an input and is mapped to ti1 10: channel is an input and is mapped to ti2 11: channel is an input and is mapped to trgi. this requires an internal trigger input selected by the ts bit in the timx_smcr register. note: cc1s may be written only when the channel is off (cc1e = 0 in the timx_ccer register).
docid16252 rev 15 209/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.3.9 timer x capture/compare mode register 2 (timx_ccmr2) address offset: 0xe01c (tim1) and 0xf01c (tim2) reset value: 0x0000 0000 the timer channels can be programmed as inputs (capture mode) or outputs (compare mode). the direction of a channel ?y? is defi ned by configuring the corresponding ccys bits in this register. all other bits have different functions in input and in output mode. for a given bit: ? ocxy describes its function when the channel is configured as an output (ccys = 0) ? icxy describes its function when the channel is configured as an input (ccys > 0) in short, the same bit can have a different meaning for the input stage and for the output stage. care should be taken. output compare mode 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved oc4m[2:0] oc4pe oc4fe cc4s[1:0] reserved oc3m[2:0] oc3pe oc3fe cc3s[1:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:15 reserved, must be kept at reset value bits 14:12 oc4m[2:0]: output compare 4 mode define the behavior of the output reference signal oc4ref from which oc4 derives. oc4ref is active high whereas oc4?s active level depends on the cc4p bit. 000: frozen - the comparison between the output compare register timx_ccr4 and the counter timx_cnt has no effect on the outputs. 001: set oc4ref to active on match. the oc4ref signal is forced high when the counter timx_cnt matches the capture/compare register 4 (timx_ccr4). 010: set oc4ref to inactive on match. oc4ref signal is forced low when the counter timx_cnt matches the capture/compare register 4 (timx_ccr4). 011: toggle - oc4ref toggles when timx_cnt = timx_ccr4 100: force oc4ref inactive 101: force oc4ref active 110: pwm mode 1 - in up-counting, oc4ref is active as long as timx_cnt < timx_ccr4, otherwise oc4ref is inactive. in down -counting, oc4ref is inactive if timx_cnt > timx_ccr4, otherwise oc4ref is active. 111: pwm mode 2 - in up-counting, oc4ref is inactive if timx_cnt < timx_ccr4, otherwise oc4ref is active. in dow n-counting, oc4ref is active if timx_cnt > timx_ccr4, otherwise it is inactive. note: in pwm mode 1 or 2, the oc4ref level changes only when the result of the comparison changes or when the output compar e mode switches from ?frozen? mode to ?pwm? mode.
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 210/285 docid16252 rev 15 bit 11 oc4pe: output compare 4 preload enable 0: buffer register for timx_ccr4 is disabled. timx_ccr4 can be written at anytime, the new value is used by the shadow register immediately. 1: buffer register for timx_ccr4 is en abled. read/write operations access the buffer register. timx_ccr4 buffer value is loaded in the shadow register at each update event. note: the pwm mode can be used without enab ling the buffer register only in one pulse mode (opm bit set in the timx_cr2 regist er), otherwise the behavior is undefined. bit 10 oc4fe: output compare 4 fast enable this bit speeds the effect of an event on the trigger in input on the oc4 output. 0: oc4 behaves normally depending on the counter and ccr4 values even when the trigger is on. the minimum delay to activate oc4 when an edge occurs on the trigger input is 5 clock cycles. 1: an active edge on the trigger input acts li ke a compare match on the oc4 output. oc4 is set to the compare level independently from the result of the comparison. delay to sample the trigger input a nd to activate oc4 output is reduced to 3 cloc k cycles. oc4fe acts only if the channel is configured in pwm 1 or pwm 2 mode. bits 9:8 cc4s[1:0]: capture / compare 1 selection this configures the channel as an output or an input. if an input, it selects the input source. 00: channel is an output 01: channel is an input and is mapped to ti4 10: channel is an input and is mapped to ti3 11: channel is an input and is mapped to trgi. this mode requires an internal trigger input selected by the ts bit in the timx_smcr register. note: cc2s may be written only when the channel is off (cc2e = 0 in the timx_ccer register). bit 7 reserved, must be kept at reset value bits 6:4 oc3m[2:0]: ou tput compare 1 mode see oc4m description above bit 3 oc3pe: output compare 3 preload enable see oc4pe description above bit 2 oc3fe: output compare 3 fast enable see oc4fe description above bits 1:0 cc3s[1:0]: capture / compare 3 selection this configures the channel as an output or an input. if an input, it selects the input source. 00: channel is an output 01: channel is an input and is mapped to ti3 10: channel is an input and is mapped to ti4 11: channel is an input and is mapped to trgi. this requires an internal trigger input selected by the ts bit in the timx_smcr register. note: cc3s may be written only when the channel is off (cc3e = 0 in the timx_ccer register).
docid16252 rev 15 211/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 input capture mode 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ic4f[3:0] ic4psc[1:0] cc4s[1:0] ic3f[3:0] ic3psc[1:0] cc3s[1:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:12 ic4f[3:0]: input capture 1 filter this defines the frequency used to sample the ti4 input, f sampling , and the length of the digital filter applied to ti4. the digita l filter requires n consecutive sa mples in the same state before being output. 0000: f sampling = pclk, no filtering 0001: f sampling = pclk, n=2 0010: f sampling = pclk, n=4 0011: f sampling = pclk, n=8 0100: f sampling = pclk/2, n=6 0101: f sampling = pclk/2, n=8 0110: f sampling = pclk/4, n=6 0111: f sampling = pclk/4, n=8 1000: f sampling = pclk/8, n=6 1001: f sampling = pclk/8, n=8 1010: f sampling = pclk/16, n=5 1011: f sampling = pclk/16, n=6 1100: f sampling = pclk/16, n=8. 1101: f sampling = pclk/32, n=5 1110: f sampling = pclk/32, n=6 1111: f sampling = pclk/32, n=8 note: pclk is 12 mhz when using the 24 mhz hse osc, and 6 mhz using the 12 mhz hsi rc oscillator. bits 11:10 ic4psc[1:0]: i nput capture 1 prescaler 00: no prescaling, capture each time an edge is detected on the capture input 01: capture once every 2 events 10: capture once every 4 events 11: capture once every 6 events bits 9:8 cc4s[1:0]: capture / compare 1 selection this configures the channel as an output or an input. if an input, it selects the input source. 00: channel is an output 01: channel is an input and is mapped to ti4 10: channel is an input and is mapped to ti3 11: channel is an input and is mapped to trgi. this mode requires an internal trigger input selected by the ts bit in the timx_smcr register. note: cc2s may be written only when the channel is off (cc2e = 0 in the timx_ccer register).
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 212/285 docid16252 rev 15 bits 7:4 ic3f[3:0]: input capture 1 filter see ic4f description above bits 3:2 ic3psc[1:0]: i nput capture 1 prescaler see ic4psc description above bits 1:0 cc3s[1:0]: capture / compare 3 selection this configures the channel as an output or an input. if an input, it selects the input source. 00: channel is an output 01: channel is an input and is mapped to ti3 10: channel is an input and is mapped to ti4 11: channel is an input and is mapped to trgi. this requires an internal trigger input selected by the ts bit in the timx_smcr register. note: cc3s may be written only when the channel is off (cc3e = 0 in the timx_ccer register).
docid16252 rev 15 213/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.3.10 timer x capture/compare enable register (timx_ccer) address offset: 0xe020 (tim1) and 0xf020 (tim2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved cc4p cc4e reserved cc3p cc3e reserved cc2p cc2e reserved cc1p cc1e rw rw rw rw rw rw rw rw bits 31:14 reserved, must be kept at reset value bit 13 cc4p: capture/compare 4 output polarity if cc4 is configured as an output channel: 0: oc4 is active high 1: oc4 is active low. if cc4 configured as an input channel: 0: ic4 is not inverted. capture occurs on a rising edge of ic4. when used as an external trigger, ic4 is not inverted. 0: ic4 is inverted. capture occurs on a falling edge of ic4. when used as an external trigger, ic4 is inverted. 1: capture is enabled bit 12 cc4e: capture/compare 4 output enable if cc4 is configured as an output channel: 0: oc4 is disabled 1: oc4 is enabled if cc4 configured as an input channel: 0: capture is disabled 1: capture is enabled bits 11:10 reserved, must be kept at reset value bit 9 cc3p: refer to the cc4p description above bit 8 cc3e: refer to the cc4e description above bits 7:6 reserved, must be kept at reset value bit 5 cc2p: refer to the cc4p description above bit 4 cc2e: refer to the cc4e description above bits 3:2 reserved, must be kept at reset value bit 1 cc1p: refer to the cc4p description above bit 0 cc1e: refer to the cc4e description above
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 214/285 docid16252 rev 15 10.3.11 timer x counter register (timx_cnt) address offset: 0xe024 (tim1) and 0xf024 (tim2) reset value: 0x0000 0000 10.3.12 timer x prescaler register (timx_psc) address offset: 0xe028 (tim1) and 0xf028 (tim2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 cnt[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:0 cnt[15:0]: counter value 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved psc[3:0] rw rw rw rw bits 31:4 reserved, must be kept at reset value bits 3:0 psc[3:0]: prescaler value the prescaler divides the internal timer clock frequency. the counter clock frequency ck_cnt is equal to fck_psc / (2 ^ psc[3:0]). clock division factors can range from 1 through 32768. the division factor is loaded into the shadow prescaler register at each update event (including when the counter is clear ed through ug bit of tim1_egr register or through the trigger controller when configured in reset mode).
docid16252 rev 15 215/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.3.13 timer x auto-reload register (timx_arr) address offset: 0xe02c (tim1) and 0xf02c (tim2) reset value: 0x0000 0000 10.3.14 timer x capture/compare 1 register (timx_ccr1) address offset: 0xe034 (tim1) and 0xf034 (tim2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 arr[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16] reserved, must be kept at reset value bits 15:0 arr[15:0]: auto-reload value arr[15:0] is the value to be loaded in the shadow auto-reload register. the auto-reload register is buffered. writing or reading the auto-reload register accesses the buffer register. the content of the buffer regi ster is transferred in the shadow register permanently or at each update event uev, dep ending on the auto-reload buffer enable bit (arpe) in timx_cr1 register. the update ev ent is sent when the counter reaches the overflow point (or underflow point when down-co unting) and if the udis bit equals 0 in the timx_cr1 register. it can also be generated by software. the counter is blocked while the auto-reload value is 0. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ccr[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:0 ccr[15:0]: capture/compare value if the cc1 channel is configured as an output (cc1s = 0): ccr1 is the buffer value to be loaded in the ac tual capture/compare 1 register. it is loaded permanently if the preload feature is not select ed in the tim1_ccmr1 register (bit oc1pe). otherwise the buffer value is copied to the shadow capture/compare 1 register when an update event occurs. the active capture/compare register contains the value to be compared to the counter tim1_cnt and signaled on the oc 1 output. if the cc1 channel is configured as an input (cc1s is not 0): ccr1 is the counter value transferred by the last input capture 1 event (ic1).
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 216/285 docid16252 rev 15 10.3.15 timer x capture/compare 2 register (timx_ccr2) address offset: 0xe038 (tim1) and 0xf038 (tim2) reset value: 0x0000 0000 10.3.16 timer x capture/compare 3 register (timx_ccr3) address offset: 0xe03c (tim1) and 0xf03c (tim2) reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ccr[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:0 see description in the timx_ccr1 register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ccr[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:0 see description in the timx_ccr1 register
docid16252 rev 15 217/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.3.17 timer x capture/compare 4 register (timx_ccr4) address offset: 0xe040 (tim1) and 0xf040 (tim2) reset value: 0x0000 0000 10.3.18 timer 1 option register (tim1_or) address offset: 0xe050 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 ccr[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:0 see description in the timx_ccr1 register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved or rsvd clk msken extrigsel[1:0] rw rw rw rw bits 31:4 reserved, must be kept at reset value bit 3 orrsvd reserved: this bit must always be set to 0 bit 2 clkmsken enables tim1msk when tim1clk is selected as the external trigger: 0 = tim1msk not used, 1 = tim1clk is anded with the tim1msk input. bits 1:0 extrigsel[1:0]: selects the external trigger used in external clock mode 2: 0 = pclk, 1 = calibrated 1 khz clock, 2 = 32 khz reference clock (if available), 3 = tim1clk pin.
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 218/285 docid16252 rev 15 10.3.19 timer 2 option register (tim2_or) address offset: 0xf050 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved re mapc4 re mapc3 re mapc2 re mapc1 or rsvd clk msken extrigsel[1:0] rw rw rw rw rw rw rw rw bits 31:8 reserved, must be kept at reset value bit 7 remapc4 selects the gpio used for tim2_ch4: 0 = pa2, 1 = pb4 bit 6 remapc3 selects the gpio used for tim2_ch3: 0 = pa1, 1 = pb3 bit 5 remapc2 selects the gpio used for tim2_ch2: 0 = pa3, 1 = pb2 bit 4 remapc1 selects the gpio used for tim2_ch1: 0 = pa0, 1 = pb1 bit 3 orrsvd reserved: this bit must always be set to 0 bit 2 clkmsken enables tim2msk when tim2clk is selected as the external trigger: 0 = tim2msk not used, 1 = tim2clk is anded with the tim2msk input. bits 1:0 extrigsel[1:0]: selects the external trigger used in external clock mode 2: 0 = pclk, 1 = calibrated 1 khz clock, 2 = 32 khz reference clock (if available), 3 = tim2clk pin.
docid16252 rev 15 219/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 10.3.20 general-purpose timers 1 and 2 (tim1/tim2) register map table 36 gives the tim1/tim2 register map and reset values. table 36. tim1/tim2 register map and reset values offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0xa800 tim1_isr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. rsvd[3:0] res. res. tip res. cc4ip cc3ip cc2ip cc1ip uip reset value 0000 0 00000 0xa804- 0xa814 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. 0xa818 tim1_missr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cc4im cc3im cc2im cc1im res. res. rsvd[6:0] reset value 0000 0000000 0xa81c- 0xa83c res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. 0xa840 tim1_ier res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. tie res. cc4ie cc3ie cc2ie cc1ie uie reset value 0 00000 0xa844- 0xdffc res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. 0xe000 tim1_cr1 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. arpe cms[1:0] dir opm urs udis cen reset value 00000000 0xe004 tim1_cr2 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ti1s mms[2:0] res. res. res. res. reset value 0000 0xe008 tim1_smcr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. etp ece etps [1:0] etf[3:0] msm ts[2:0] res. sms[2:0] reset value 000000000000 000 0xe014 tim1_egr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. tg res. cc4g cc3g cc2g cc1g ug reset value 0 00000 0xe018 tim1_ccmr1 output compare mode res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. oc2m [2:0] oc2pe oc2fe cc2s [1:0] res. oc1m [2:0] oc1pe oc1fe cc1s [1:0] reset value 0000000 0000000 tim1_ccmr1 input capture mode res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ic2f [3:0] ic2 psc [1:0] cc2s [1:0] ic1f [3:0] ic1 psc [1:0] cc1s [1:0] reset value 0000000000000000 0xe01c tim1_ccmr2 output compare mode res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. oc4m [2:0] oc4pe oc4fe cc4s [1:0] res. oc3m [2:0] oc3pe oc3fe cc3s [1:0] reset value 0000000 0000000 tim1_ccmr2 input capture mode res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ic4f [3:0] ic4 psc [1:0] cc4s [1:0] ic3f [3:0] ic3 psc [1:0] cc3s [1:0] reset value 0000000000000000 0xe020 tim1_ccer res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cc4p cc4e res. res. cc3p cc3e res. res. cc2p cc2e res. res. cc1p cc1e reset value 00000000
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 220/285 docid16252 rev 15 0xe024 tim1_cnt res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cnt[15:0] reset value 0000000000000000 0xe028 tim1_psc res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. psc[15:0] reset value 0000000000000000 0xe02c tim1_arr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. arr[15:0] reset value 0000000000000000 0xe030 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. 0xe034 tim1_ccr1 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ccr[15:0] reset value 0000000000000000 0xe038 tim1_ccr2 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ccr[15:0] reset value 0000000000000000 0xe03c tim1_ccr3 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ccr[15:0] reset value 0000000000000000 0xe040 tim1_ccr4 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ccr[15:0] reset value 0000000000000000 0xe044- 0xe04c res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. 0xe050 tim1_or res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. orrsvd clkmsken ext rig sel [1:0] reset value 0000 0xa804 tim2_isr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. rsvd[3:0] res. res. tip res. cc4ip cc3ip cc2ip cc1ip uip reset value 0000 0 00000 0xa808- 0xa810 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. 0xa81c tim2_missr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cc4im cc3im cc2im cc1im res. res. rsvd[6:0] reset value 0000 0000000 0xa820- 0xa840 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. 0xa844 tim2_ier res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. tie res. cc4ie cc3ie cc2ie cc1ie uie reset value 0 00000 0xa848- 0xeffc res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. 0xf000 tim2_cr1 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. arpe cms[1:0] dir opm urs udis cen reset value 00000000 table 36. tim1/tim2 register map and reset values (continued) offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
docid16252 rev 15 221/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz general-purpose timers 281 0xf004 tim2_cr2 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ti1s mms[2:0] res. res. res. res. reset value 0000 0xf008 tim2_smcr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. etp ece etps [1:0] etf[3:0] msm ts[2:0] res. sms[2:0] reset value 000000000000 000 0xf014 tim2_egr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. tg res. cc4g cc3g cc2g cc1g ug reset value 0 00000 0xf018 tim2_ccmr1 output compare mode res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. oc2m [2:0] oc2pe oc2fe cc2s [1:0] res. oc1m [2:0] oc1pe oc1fe cc1s [1:0] reset value 0000000 0000000 tim2_ccmr1 input capture mode res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ic2f [3:0] ic2 psc [1:0] cc2s [1:0] ic1f [3:0] ic1 psc [1:0] cc1s [1:0] reset value 0000000000000000 0xf01c tim2_ccmr2 output compare mode res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. oc4m [2:0] oc4pe oc4fe cc4s [1:0] res. oc3m [2:0] oc3pe oc3fe cc3s [1:0] reset value 0000000 0000000 tim2_ccmr2 input capture mode res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ic4f [3:0] ic4 psc [1:0] cc4s [1:0] ic3f [3:0] ic3 psc [1:0] cc3s [1:0] reset value 0000000000000000 0xf020 tim2_ccer res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cc4p cc4e res. res. cc3p cc3e res. res. cc2p cc2e res. res. cc1p cc1e reset value 00000000 0xf024 tim2_cnt res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. cnt[15:0] reset value 0000000000000000 0xf028 tim2_psc res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. psc[15:0] reset value 0000000000000000 0xf02c tim2_arr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. arr[15:0] reset value 0000000000000000 0xf030 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. 0xf034 tim2_ccr1 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ccr[15:0] reset value 0000000000000000 0xf038 tim2_ccr2 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ccr[15:0] reset value 0000000000000000 0xf03c tim2_ccr3 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ccr[15:0] reset value 0000000000000000 0xf040 tim2_ccr4 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. ccr[15:0] reset value 0000000000000000 table 36. tim1/tim2 register map and reset values (continued) offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
general-purpose timers stm32w108hb stm32w108cc stm32w108cb stm32w108cz 222/285 docid16252 rev 15 refer to figure 4: stm32w108xb memory mapping, figure 5: stm32w108cc and stm32w108cz memory mapping, and table 3: stm32w108xx peripheral register boundary addresses for the register boundary addresses of the peripherals available in all stm32w108xx devices. 0xf044- 0xf04c res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. 0xf050 tim2_or res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. remapc4 remapc3 remapc2 remapc1 orrsvd clkmsken ext rig sel [1:0] reset value 00000000 table 36. tim1/tim2 register map and reset values (continued) offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
docid16252 rev 15 223/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz analog-to-digital converter 281 11 analog-to-digital converter the stm32w108 analog-to-digital converter (adc) is a first-order sigma-delta converter with the following features: ? resolution of up to 12 bits ? sample times as fast as 5.33 s (188 khz) ? differential and single-ended conversions from six external and four internal sources ? two voltage ranges (differential): -vre f to +vref, and ?vdd_pads to +vdd_pads ? choice of internal or external vref: internal vref may be output ? digital offset and gain correction ? dedicated dma channel with one-shot and continuous operating modes figure 51 shows the basic adc structure. figure 51. adc block diagram 1. for the stm32w108cc and stm32108cz devices, the input range selection block is not present on the n input. while the adc module supports both single-ended and differential inputs, the adc input stage always operates in differential mode. single-ended conversions are performed by connecting one of the differential inputs to vr ef/2 while fully differential operation uses two external inputs. note: this note only applies to stm32w108xb. in high voltage mode, input buffers (with 0.25 gain only) may experience long term drift of its input offset voltag e that affects adc accuracy. in these cases, only the 1.2v input range mode of the adc should be used. if measurement of signals >1.2v is required, then ex ternal attenuation should be added. note: for stm32w108cc and stm32108cz, high voltage mode is supported only in single mode. it is also required by th e software to periodically set to 1 bit hvseln in the register adc_cr.
analog-to-digital converter stm32w108hb stm32w108cc stm32w108cb stm32w108cz 224/285 docid16252 rev 15 11.1 functional description 11.1.1 setup and configuration to use the adc follow this procedure, descri bed in more detail in the next sections: ? configure any gpio pins to be used by the adc in analog mode. ? configure the voltage reference (internal or external). ? set the offset and gain values. ? reset the adc dma, define the dma buffer, and start the dma in the proper transfer mode. ? if interrupts will be used, configure the primary adc inte rrupt and specific mask bits. ? write the adc configuration register to defi ne the inputs, voltage range, sample time, and start the conversions. 11.1.2 gpio usage a gpio pin used by the adc as an input or volt age reference must be configured in analog mode by writing 0 to its 4-bit field in the proper gpiox_crh/l register. note that a gpio pin in analog mode cannot be used for any digital f unctions, and software always reads it as 1. see section 8: general-purpose input/output on page 91 for more information about how to configure the gpio pins. 11.1.3 voltage reference the adc voltage reference (vref), may be internally generated or externally sourced from pb0. if internally generated, it may optionally be output on pb0. to use an external reference, an st system function must be called after reset and after waking from deep sleep. pb0 must also be configured in analog mode using gpiob_crh[3:0]. see the stm32w108 hal documentation for more information on the system functions required to use an external reference. table 37. adc gpio pin usage analog signal gpio configuration control adc0 input pb5 gpiob_crh[7:4] adc1 input pb6 gpiob_crh[11:8] adc2 input pb7 gpiob_crh[15:12] adc3 input pc1 gpioc_crh[7:4] adc4 input pa4 gpioa_crh[3:0] adc5 input pa5 gpioa_crh[7:4] vref input or output pb0 gpiob_crh[3:0]
docid16252 rev 15 225/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz analog-to-digital converter 281 11.1.4 offset/gain correction when a conversion is complete, the 16-bit converted data is processed by offset/gain correction logic: ? the basic adc conversion result is added to the 16-bit signed (two?s complement) value of the adc offset register (adc_offsetr). ? the offset-corrected data is multiplied by the 16-bit adc gain register, adc_gainr, to produce a 16-bit signed result. if the prod uct is greater than 0x7fff (32767), or less than 0x8000 (-32768), it is limited to that value and the sat bit is set in the adc_isr register. ? the offset/gain corrected value is divid ed by two to produce the final result. adc_gainr is an unsigned scaled 16-bit value: gain[15] is the integer part of the gain factor and gain[14:0] is the fractional part . as a result, adc_gainr values can represent gain factors from 0 through (2 ? 2 -15 ). reset initializes the offset to zero (a dc_offsetr = 0) and gain factor to one (adc_gainr = 0x8000). for the stm32w108cc and stm32108cz devices, a software mechanism is used to measure and cancel t he hv buffer offset. the hv offset calculation requires two me asurements with respectively chop = 1 and chop = 0. the hv offset values is then calculated as follows: where: (hv_buf_out) 0 and (hv_buf_out) 1 are the outputs of the hv buffer (input of the adc). 11.1.5 dma the adc dma channel writes converted data, which incorporates the offset/gain correction, into a dma buffer in ram. the adc dma buffer is defined by two registers: ? adc_dmamsar is the start address of the buffer and must be even. ? adc_dmandtr specifies the size of the buffer in 16-bit samples, or half its length in bytes. to prepare the dma channel for operation, reset it by writing the rst bit in the adc_dmacr register, then start the dma in either linear or auto wrap mode by setting the load bit in the adc_dmacr register. the autowrap bit in the adc_dmacr register selects the dma mode: 0 for linear mode, 1 for auto wrap mode. ? in linear mode the dma writes to the buffer until the number of samples given by adc_dmandtr has been output. then the dma stops and sets the dmabf bit in the adc_isr register. if another adc conversion completes before the dma is reset or the adc is disabled, the dmaovf bit in the adc_isr register is set. ? in auto wrap mode the dma writes to the buf fer until it reaches the end, then resets its pointer to the start of the buffer and continues writing samples. the dma transfers continue until the adc is disabled or the dma is reset. 2 hv_buf_out () 0 hv_buf_out () 1 ? ()
analog-to-digital converter stm32w108hb stm32w108cc stm32w108cb stm32w108cz 226/285 docid16252 rev 15 when the dma fills the lower and upper halves of the buff er, it sets the dmabhf and dmabf bits, respectively, in th e adc_isr register. the current location to which the dma is writing can also be determined by reading the adc_dmamnar register. 11.1.6 adc configuration register the adc configuration register (adc_cr) sets up most of the adc operating parameters. input the analog input of the adc can be chosen from various sources. the analog input is configured with the chselp[3:0] and chseln[ 3:0] bits within the adc_cr register. table 38 shows the possible input selections. table 38. adc inputs chselp[3:0]/ chseln[3:0] (1) 1. denotes bits chselp[3:0] or chseln[3:0] in register adc_cr. analog source at adc gpio pin purpose 0 adc0 pb5 1 adc1 pb6 2 adc2 pb7 3 adc3 pc0 4adc4 pa4 5adc5 pa5 6 no connection 7 no connection 8 gnd internal connection calibration 9 vref/2 internal connection calibration 10 vref internal connection calibration 11 1v8 vreg/2 internal connection supply monitoring and calibration 12 no connection 13 no connection 14 no connection 15 no connection
docid16252 rev 15 227/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz analog-to-digital converter 281 table 39 shows the typical configurations of adc inputs. input range adc inputs can be routed through input buffers to expand the input voltage range. the input buffers have a fixed 0.25 gain and the converted data is scaled by that factor. with the input buffers disabled the single-ended input range is 0 to vref and the differential input range is -vref to +vref. with the input buffers enabled the single-ended range is 0 to vdd_pads and the differential range is -vdd_pads to +vdd_pads. the input buffers are enabled for the adc p and n inputs by se tting the hvselp and hvseln bits respectively, in the adc_cr regi ster. the adc accuracy is reduced when the input buffer is selected. sample time adc sample time is programmed by selecting the sampling clock and the clocks per sample. ? the sampling clock may be either 1 mhz or 6 mhz. if the clk bit in the adc_cr register is clear, the 6 mhz clock is used; if it is set, the 1 mhz clock is selected. the 6 mhz sample clock offers faster conversion times but the ad c resolution is lower than that achieved with the 1 mhz clock. ? the number of clocks per sample is determined by the sm p[2:0] bits in the adc_cr register. smp[2:0] values se lect from 32 to 4096 sampling clocks in powers of two. longer sample times produce more significant bits. regardless of the sample time, converted samples are always 16-bits in size with the significant bits left-aligned within the value. table 39. typical adc input configurations adc p input adc n input chsel p[3:0] chseln[3:0] purpose adc0 vref/2 0 9 single-ended adc1 vref/2 1 9 single-ended adc2 vref/2 2 9 single-ended adc3 vref/2 3 9 single-ended adc4 vref/2 4 9 single-ended adc5 vref/2 5 9 single-ended adc1 adc0 1 0 differential (1) 1. the differential is only in lv mode. adc3 adc2 3 2 differential (1) adc5 adc4 5 4 differential (1) gnd vref/2 8 9 calibration vref vref/2 10 9 calibration vdd_padsa/2 vref/2 11 9 calibration
analog-to-digital converter stm32w108hb stm32w108cc stm32w108cb stm32w108cz 228/285 docid16252 rev 15 table 40 shows the options for adc sample times and the significant bits in the conversion results. note: adc sample timing is the same whether the stm32w108 is using the 24 mhz hse osc or the 12 mhz hsi rc oscillator. this facilitates using the adc soon after the cpu wakes from deep sleep, before switchin g to the crystal oscillator. 11.1.7 operation setting the adc_en bit in th e adc_cr register enables the adc; once enabled, it performs conversions continuously until it is disabled. if the adc had previously been disabled, a 21 s analog startup delay is imposed before the adc starts conversions. the delay timing is performed in hardware and is simply added to the time until the first conversion result is output. when the adc is first enabled, and or if any ch ange is made to adc_cr after it is enabled, the time until a result is outp ut is double the normal sample time. this is because the adc?s internal design requires it to discard the firs t conversion after startup or a configuration change. this is done automatically and is hidden from software except for the longer timing. switching the processor clock between the rc an d crystal oscillator also causes the adc to go through this startup cycle. if the adc was newly enabled, the analog delay time is added to the doubled sample time. if the dma is running when adc_cr is modified , the dma does not stop, so the dma buffer may contain conversion results from both the old and new configurations. table 40. adc sample times smp[2:0] sample clocks sample time (s) samp le frequency (khz) significant bits 1 mhz clock 6 mhz clock 1 mhz clock 6 mhz clock 032325.3331.3188 5 1 64 64 10.7 15.6 93.8 6 2 128 128 21.3 7.81 46.9 7 3 256 256 42.7 3.91 23.4 8 4 512 512 85.3 1.95 11.7 9 5 1024 1024 170 0.977 5.86 10 6 2048 2048 341 0.488 2.93 11 7 4096 4096 682 0.244 1.47 12
docid16252 rev 15 229/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz analog-to-digital converter 281 the following procedu re illustrates a simple polled me thod of using the adc. after completing the procedure, the latest conversion results is available in the location written to by the dma. this assumes that any gpios and the voltage reference have already been configured. 1. allocate a 16-bit signed variable, for example analogdata, to receive the adc output. (make sure that analogdata is half-word aligned ? that is, at an even address.) 2. disable all adc interrup ts ? write 0 to adc_ier. 3. set up the dma to output conversion results to the variable, analogdata. reset the dma ? set the rst bit in adc_dmacr. define a one sample buffer ? write analogdata?s address to adc_dmamsar, set adc_dmandtr to 1. 4. write the desired offset and gain corr ection values to the adc_offsetr and adc_gainr registers. 5. start the adc and the dma. write the desired conversion configuration, with the adc_en bit set, to adc_cr. clear the adc buffer full flag ? write dmabf to adc_isr. start the dma in auto wrap mode ? set the autowrap and load bits in adc_dmacr. 6. wait until the dmabf bit is set in adc_is r, then read the result from analogdata. to convert multiple inputs using this approach, repeat steps 4 through 6, loading the desired input configurations to adc_cr in step 5. if the inputs can use the same offset/gain correction, just repeat steps 5 and 6. 11.1.8 calibration sampling of internal connections gnd, vref/2, and vref allow for offset and gain calibration of the adc in applications where ab solute accuracy is import ant. offset error is calculated from the minimum input and gain e rror is calculated from the full scale input range. correction using vref is recommended because vref is calibrated by the st software against vdd_padsa. t he vdd_padsa regulator is trimmed to 1.80 v 50 mv. if better absolute accuracy is required, the adc can be configured to use an external reference. the adc calibrates as a single-ended measurement. differential signals require correction of both their inputs. table 41 shows the equations used to calculate the gain and offset correction values.
analog-to-digital converter stm32w108hb stm32w108cc stm32w108cb stm32w108cz 230/285 docid16252 rev 15 equation notes ? all n are 16-bit two?s complement numbers. ? n gnd is a sampling of ground. due to the adc's internal design, vgnd does not yield the minimum two?s complement value 0x8000 as the conversion result. instead, vgnd yields a two?s complement value close to 0x e000 when the input buffer is not selected. vgnd cannot be measured when the input buffe r is enabled because it is outside the buffer?s input range. ? n vref is a sampling of vref. due to the adc' s internal design, vref does not yield the maximum positive two?s complement 0x7f ff as the conversion result. instead, vref yields a two?s complement value close to 0x2000 when the input buffer is not selected and yields a two?s complement val ue close to 0xf000 when the input buffer is selected. ? offset correction is affected by the gain corr ection value. offset correction is calculated after gain correction has been applied. table 41. adc gain and offset correction equations calibration correction value gain offset (after applying gain correction) 32768 16384 n vref n gnd ? () ------------------------------------------ ? ()
docid16252 rev 15 231/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz analog-to-digital converter 281 11.2 interrupts four kinds of adc events can generate an adc interrupt, and each has a bit flag in the adc_isr register to identify the reason(s) for the interrupt: ? dmaovf ? an adc conversion result was ready but the dma was disabled (dma buffer overflow). ? sat ? the gain correction multiplication exceeded the limits for a signed 16-bit number (gain saturation). ? dmabf ? the dma wrote to the last location in the buffer (dma buffer full). ? dmabhf ? the dma wrote to the last location of the first half of the dma buffer (dma buffer half full). bits in adc_isr may be cleared by writing a 1 to their position. the adc_ier register controls whether or not adc_isr bits actually request the arm ? cortex-m3 adc interrupt; on ly the events whose bits are 1 in adc_ier can do so. for non-interrupt (polled) adc operation set adc_ier to zero, and read the bit flags in adc_isr to determine the adc status. note: when making changes to the adc configuration it is best to disable the dma beforehand. if this isn?t done it can be difficult to determi ne at which point the sample data in the dma buffer switch from the old configuration to the new configuration. however, since the adc will be left running, if it comp letes a conversion af ter the dma is disabl ed, the dmaovf flag will be set. to prevent these unwanted dma bu ffer overflow indications, clear the dmaovf flag immediately after enabling the dma, preferably with interrupts off. disabling the adc in addition to the dma is often undesirable becaus e of the additional analog startup time when it is re-enabled.
analog-to-digital converter stm32w108hb stm32w108cc stm32w108cb stm32w108cz 232/285 docid16252 rev 15 11.3 analog-to-digital converter (adc) registers 11.3.1 adc interrupt stat us register (adc_isr) address offset: 0xa810 reset value: 0x0000 0000 11.3.2 adc interrupt enab le register (adc_ier) address offset: 0xa850 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved dma ovf sat dma bf dma bhf reserved rw rw rw rw bits 31:5] reserved, must be kept at reset value bit 4 dmaovf: dma buffer overflow interrupt pending bit 3 sat: gain correction sa turation interrupt pending bit 2 dmabf: dma buffer full interrupt pending bit 1 dmabhf: dma buffer half full interrupt pending bit 0 reserved: this bit should always be set to 1 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved dma ovfie satie dma bfie dma bhfie reserved rw rw rw rw bits 31:5 reserved, must be kept at reset value bit 4 dmaovfie: dma buffer overflow interrupt enable bit 3 satie: gain correction saturation interrupt enable bit 2 dmabfie: dma buffer full interrupt enable bit 1 dmabhfie: dma buffer half full interrupt enable bit 0 reserved: this bit must always be set to 0
docid16252 rev 15 233/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz analog-to-digital converter 281 11.3.3 adc control register (adc_cr) address offset: 0xd004 reset value: 0x0000 1800 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 smp[2:0] hvselp hvseln chselp[3:0] chseln[3:0] clk reserved adon rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:13 smp[2:0]: adc sample time in clocks and the equivalent significant bits in the conversion 0: 32 clocks (5 bits) 1: 64 clocks (6 bits) 2: 128 clocks (7 bits) 3: 256 clocks (8 bits) 4: 512 clocks (9 bits) 5: 1024 clocks (10 bits) 6: 2048 clocks (11 bits) 7: 4096 clocks (12 bits) bit 12 hvselp: select voltage range for the p input channel 0: low voltage range (input buffer disabled) 1: high voltage range (input buffer enabled) bit 11 hvseln: select voltage range for the n input channel 0: low voltage range (input buffer disabled). 1: high voltage range (input buffer enabled). note: for the stm32w108cc and stm32w108c z, the hvseln register allows the chopper to be controlled . bits 10:7 chselp[3:0]: input selection for the p channel 0x0: pb5 pin 0x1: pb6 pin 0x2: pb7 pin 0x3: pc1 pin 0x4: pa4 pin 0x5: pa5 pin 0x8: gnd (0v) (not for high voltage range) 0x9: vref/2 (0.6v) 0xa: vref (1.2v) 0xb: vreg/2 (0.9v) (not for high voltage range) 0x6, 0x7, 0xc-0xf: reserved, must be kept at reset value bits 6:3 chseln[3:0]: input selection for the n channel refer to chselp[3:0] above for choices bit 2 clk: select adc clock: 0: 6 mhz1: 1 mhz
analog-to-digital converter stm32w108hb stm32w108cc stm32w108cb stm32w108cz 234/285 docid16252 rev 15 11.3.4 adc offset register (adc_offsetr) address offset: 0xd008 reset value: 0x0000 0000 11.3.5 adc gain register (adc_gainr) address offset: 0xd00c reset value: 0x0000 8000 bit 1 reserved: this bit must always be set to 0 bit 0 adon: a/d converter on/off this bit is set and cleared by software. write 1 to enable continuous conversions and write 0 to stop. when the adc is started, the first c onversion takes twice the usual number of clocks plus 21 microseconds. if anything in this regi ster is modified while the adc is running, the next conversion takes twic e the usual number of clocks. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 offset[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:0 offset[15:0]: 16-bit signed offset added to the basic adc co nversion result before gain correction is applied. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 gain[15:0] rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:16 reserved, must be kept at reset value bits 15:0 gain[15:0]: gain factor that is multiplied by the offset-c orrected adc result to produce the output value. the gain is a 16-bit unsigned scaled integer value with a binary decimal point between bits 15 and 14. it can represent values from 0 to (almos t) 2. the reset value is a gain factor of 1.
docid16252 rev 15 235/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz analog-to-digital converter 281 11.3.6 adc dma contro l register (adc_dmacr) address offset: 0xd010 reset value: 0x0000 0000 11.3.7 adc dma status register (adc_dmasr) address offset: 0xd014 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved rst reserved auto wrap load wrwrw bits 31:5 reserved, must be kept at reset value bit 4 rst: write 1 to reset the adc dma. this bit auto-clears. bits 3:2 reserved, must be kept at reset value bit 1 autowrap: selects dma mode 0: linear mode, the dma stops when the buffer is full. 1: auto-wrap mode, the dma ou tput wraps back to the start when the buffer is full. bit 0 load: loads the dma buffer write 1 to start dma (writing 0 has no effect). cleared when dma starts or is reset. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved ovf act rr bits 31:2 reserved, must be kept at reset value bit 1 ovf: dma overflow occurs when an adc result is ready and the dma is not active. cleared by dma reset. bit 0 act: dma status reads 1 if dma is active.
analog-to-digital converter stm32w108hb stm32w108cc stm32w108cb stm32w108cz 236/285 docid16252 rev 15 11.3.8 adc dma memory start address register (adc_dmamsar) address offset: 0xd018 reset value: 0x2000 0000 11.3.9 adc dma number of data to transfer regist er (adc_dmandtr) address offset: 0xd01c reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved msa[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0] msa[12:0]: memory start address 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved ndt[12:0] rw rw rw rw rw rw rw rw rw rw rw rw rw bits 31:13 reserved, must be kept at reset value bits 12:0 ndt[12:0]: number of data to transfer this is the number of 16-bit adc conversion results the buffer can hold, not its length in bytes. (the length in bytes is twice this value) .
docid16252 rev 15 237/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz analog-to-digital converter 281 11.3.10 adc dma memory next address register (adc_dmamnar) address offset: 0xd020 reset value: 0x2000 0000 11.3.11 adc dma count number of data transferred register (adc_dmacndtr) address offset: 0xd024 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved mna[12:0] reserved rrrrrrrr rrrrr bits 31:14 reserved, must be kept at reset value bits 13:1 mna[12:0]: memory next address the location that is written next by the dma bit 0 reserved, must be kept at reset value 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved cndt[12:0] rrr r r r r r rr r r r bits 31:13 reserved, must be kept at reset value bits 12:0 cndt[12:0]: count the number of dma transferred data: the nu mber of 16-bit conversion results that have been written to the buffer.
analog-to-digital converter stm32w108hb stm32w108cc stm32w108cb stm32w108cz 238/285 docid16252 rev 15 11.3.12 analog-to-digital c onverter (adc) register map table 42 gives the adc register map and reset values. table 42. adc register map and reset values offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0xa810 adc_isr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . dmaovf sat dmabf dmabhf re s . reset value 0000 0xa814- 0xa84c re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . 0xa850 adc_ier re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . dmaovfie satie dmabfie dmabhfie re s . reset value 0000 0xa854- 0xd000 re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . 0xd004 adc_cr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . smp[2:0] hvselp hvseln chselp[3:0] chseln[3:0] clk re s . adon reset value 00011000000000 0 0xd008 adc_offsetr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . offset[15:0] reset value 0000000000000000 0xd00c adc_gainr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . gain[15:0] reset value 0000000000000000 0xd010 adc_dmacr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . rst re s . re s . autowrap load reset value 000 0xd014 adc_dmasr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . ovf act reset value 00 0xd018 adc_dmamsar re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . msa[12:0] reset value 0000000000000 0xd01c adc_dmandtr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . ndt[12:0] reset value 0000000000000 0xd020 adc_dmamnar re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . mna[12:0] re s . reset value 000000000000 0xd024 adc_dmacndtr re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . re s . cndt[12:0] reset value 0000000000000
docid16252 rev 15 239/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz analog-to-digital converter 281 refer to figure 4: stm32w108xb memory mapping, figure 5: stm32w108cc and stm32w108cz memory mapping, and table 3: stm32w108xx peripheral register boundary addresses for the register boundary addresses of the peripherals available in all stm32w108xx devices.
interrupts stm32w108hb stm32w108cc stm32w108cb stm32w108cz 240/285 docid16252 rev 15 12 interrupts the interrupt system of the stm32w108 is composed of two parts: ? a standard arm? cortex-m3 nested vect ored interrupt controller (nvic) that provides top level interrupts ? an event manager (em) that provides second level interrupts. the nvic and em provide a simple hierarchy. all second level interrupts from the em feed into top level interrupts in the nvic. this tw o level hierarchy allows for both fine granular control of interrupt sources and coarse granular control over all peripherals, while allowing the peripherals to have their own interrupt vector. in practice, top level peripheral interrupts are only used to enable or disable interrupts for an entire peripheral. second level interrupts originate from hardware sources, and therefore are the main focus of applications using interrupts. 12.1 nested vectored in terrupt controller (nvic) the arm? cortex-m3 nested vectored interrup t controller (nvic) facilitates low-latency exception and interrupt handling. the nvic and the processor core interface are closely coupled, which enables low-late ncy interrupt processing and ef ficient processing of late arriving interrupts. the nvic also maintains knowledge of the stacked (nested) interrupts to enable tail-chaining of interrupts. the arm? cortex-m3 nvic contains 10 standard interrupts that are related to chip and cpu operation and management. in addition to the 10 standard interrupts, it contains 17 individually vectored peripheral in terrupts specific to the stm32w108. the nvic defines a list of exceptions (see table 43 ). these exceptions include not only traditional peripheral interrupts, but also mo re specialized events such as faults and cpu reset. in the arm? cortex-m3 nvic, a cpu reset event is considered an exception of the highest priority, and the stack pointer is loaded from the first position in the nvic exception table. the nvic exception table defines a ll exceptions and their position, including peripheral interrupts. the position of each except ion is important since it directly translates to the location of a 32-bit interrupt vector for each interrupt, and defines the hardware priority of exceptions. each exception in the table is a 32-bit address that is loaded into the program counter when that exception occurs. exceptions 0 (stack pointer) through 15 (systick) are part of the standard arm? cort ex-m3 nvic, while exceptions 16 (timer 1) through 32 (debug) are the peripheral interrupts specific to the stm32w108 peripherals. table 43. nvic exception table exception position description - 0 stack top is loaded from first entry of vector table on reset. reset 1 invoked on power up and warm reset. on first instruction, drops to lowest priority (thread mode). asynchronous. nmi 2 cannot be stopped or preempted by any exception but reset. asynchronous. hard fault 3 all classes of fault, when the fault cannot activa te because of priority or the configurable fault handler has been disabled. synchronous.
docid16252 rev 15 241/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz interrupts 281 memory fault 4 mpu mismatch, including access violation and no match. synchronous. bus fault 5 pre-fetch, memory access, and othe r address/memory-related faults. synchronous when precise and asynchronous when imprecise. usage fault 6 usage fault, such as 'undefined inst ruction executed' or 'illegal state transition attempt'. synchronous. - 7-10 reserved, must be kept at reset value svcall 11 system service call with svc instruction. synchronous. debug monitor 12 debug monitor, when not halting. synchronous, but only active when enabled. it does not activate if lower priority than the current activation. - 13 reserved, must be kept at reset value pendsv 14 pendable request for system servic e. asynchronous and only pended by software. systick 15 system tick timer has fired. asynchronous. timer 1 16 timer 1 pe ripheral interrupt. timer 2 17 timer 2 pe ripheral interrupt. management 18 management peripheral interrupt. baseband 19 baseband peripheral interrupt. sleep timer 20 sleep timer peripheral interrupt. serial controller 1 21 serial controller 1 peripheral interrupt. serial controller 2 22 serial controller 2 peripheral interrupt. security 23 security pe ripheral interrupt. mac timer 24 mac timer peripheral interrupt. mac transmit 25 mac transmit peripheral interrupt. mac receive 26 mac receive peripheral interrupt. adc 27 adc peripheral interrupt. irqa 28 irqa peripheral interrupt. irqb 29 irqb peripheral interrupt. irqc 30 irqc peripheral interrupt. irqd 31 irqd peripheral interrupt. debug 32 debug peripheral interrupt. table 43. nvic exception table (continued) exception position description
interrupts stm32w108hb stm32w108cc stm32w108cb stm32w108cz 242/285 docid16252 rev 15 the nvic also contains a software-configurab le interrupt prioritization mechanism. the reset, nmi, and hard fault exceptions, in that order, are always the highest priority, and are not software-configurable. all other exceptions can be assigned a 5-bit priority number, with low values representing higher priority. if any exceptions have the same software- configurable priority, then the nvic uses th e hardware-defined priority. the hardware- defined priority number is the same as the po sition of the exception in the exception table. for example, if irqa and irqb both fire at the same time and have the same software- defined priority, the nvic handles irqa, with priority number 28, first because it has a higher hardware priority than irqb with priority number 29. for further information on the nvic and cort ex-m3 exceptions, refer to the arm? cortex- m3 technical reference manual and the ar m armv7-m architecture reference manual. 12.2 management interrupt registers 12.2.1 management interrupt source register (mgmt_isr) address offset: 0x4000 a018 reset value: 0x0000 0000 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved hse comph lif hse compl lif rw rw bits 31:2 reserved, must be kept at reset value bit 1 hsecomphlif: osc24m_hi interrupt bit 0 hsecompllif: osc24m_lo interrupt
docid16252 rev 15 243/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz interrupts 281 12.2.2 management interrupt mask register (mgmt_ier) address offset: 0x4000 a058 reset value: 0x0000 0000 12.2.3 management interr upt (mgmt) register map table 44 gives the adc register map and reset values. refer to figure 4: stm32w108xb memory mapping and figure 5: stm32w108cc and stm32w108cz memory mapping for the register boundary addresses. 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 reserved 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 reserved hse comph lie hse compl lie rw rw bits 31:2 reserved, must be kept at reset value bit 1 hsecomphlie: osc24m_hi mask bit 0 hsecompllie: osc24m_lo mask table 44. mgmt register map and reset values offset register 31 30 29 28 27 26 25 24 23 22 21 20 19 18 17 16 15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0 0xa018 mgmt_isr res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. hsecomphlif hsecompllif reset value 00 0xa01c- 0xa054 res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. 0xa058 mgmt_ier res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. res. hsecomphlie hsecompllie reset value 00
debug support stm32w108hb stm32w108cc stm32w108cb stm32w108cz 244/285 docid16252 rev 15 13 debug support the stm32w108 includes a standard serial wi re and jtag (swj) interface. the swj is the primary debug and programming interface of the stm32w108. the swj gives debug tools access to the internal buses of the stm32w108, and allows for non-intrusive memory and register access as well as cpu halt-s tep style debugging. therefore, any design implementing the stm32w108 should make the swj signals readily available. serial wire is an arm? standard, bi-direc tional, two-wire protocol designed to replace jtag, and provides all the normal jtag debug and test functionality. jtag is a standard five-wire protocol providing debug and test func tionality. in addition, the two serial wire signals (swdio and swclk) are overlaid on two of the jtag signals (jtms and jtck). this keeps the design compact and allows debu g tools to switch between serial wire and jtag as needed, without changing pin connections. while serial wire and jtag offer the same debug and test functionality, st recommends serial wire. serial wire uses only two pi ns instead of five, and offers a simple communication protocol, high performance data rates, low power, built-in error detection, and protection from glitches. the arm? coresight debug access port (dap) comprises the serial wire and jtag interface (swj).the dap includes two primary components: a debug port (the swj-dp) and an access port (the ahb-ap). the swj-dp provides external debug access, while the ahb-ap provides internal bus access. an external debug tool connected to the stm32w108's debug pins communicates with the swj-dp. the swj-dp then communicates with the ahb-ap. finally, the ahb-ap communicates on the internal bus. figure 52. swj block diagram serial wire and jtag share five pins: ? jrst ? jtdo ? jtdi ? swdio/jtms ? swclk/jtck since these pins can be repurposed, refer to section 3: pinout and pin description on page 19 and section 8: general-purpose input/output on page 91 for complete pin descriptions and configurations. swj-dp swj-dp select swj-dap sw interface jtag interface control and ap interface pins ahb-ap ahb
docid16252 rev 15 245/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz debug support 281 13.1 stm32w108 jtag tap connection the stm32w108 mcu integrates two serially-co nnected jtag taps in the following order; the tmc tap dedicated for test (ir is 4-bit wide) and the cortex?-m3 tap (ir is 4-bit wide). to access the tap of the cortex-m3 for debug purposes: 1. first, it is necessary to shift the bypass instruction of the tmc tap. 2. then, for each ir shift, the scan chain contains 8 bits (= 4 + 4) and the unused tap instruction must be shifted in using the bypass instruction. 3. for each data shift, the unused tap, whic h is in bypass mode, adds 1 extra data bit in the data scan chain. note: important : once serial-wire is selected using the dedicated arm jtag sequence, the tmc tap is automatically di sabled (jtms forced high).
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 246/285 docid16252 rev 15 14 electrical characteristics 14.1 parameter conditions unless otherwise specified, all voltages are referenced to v ss . 14.1.1 minimum and maximum values unless otherwise specified the minimum and ma ximum values are guaranteed in the worst conditions of ambient temperature, supply voltage and frequencies by tests in production on 100% of the devices with an ambient temperature at t a = 25 c and t a = t a max (given by the selected temperature range). data based on characterization results, design simulation and/or technology characteristics are indicated in the table footnotes and are not tested in production. based on characterization, the minimum and maximum values refer to sample tests and represent the mean value plus or minus three times the standard deviation (mean3 ). 14.1.2 typical values unless otherwise specified, typical data are based on t a = 25 c, v dd = 3.3 v (for the 2v v dd 3.6 v voltage range). they are given only as design guidelines and are not tested. typical adc accuracy values are determined by characterization of a batch of samples from a standard diffusion lot over the full temperature range, where 95% of the devices have an error less than or equal to the value indicated (mean2 ) . 14.1.3 typical curves unless otherwise specified, all typical curves are given only as design guidelines and are not tested. 14.1.4 loading capacitor the loading conditions used for pin parameter measurement are shown in figure 53 . 14.1.5 pin input voltage the input voltage measurement on a pin of the device is described in figure 54 . figure 53. pin loading conditi ons figure 54. pin input voltage stm32w c = 50 pf stm32w v in
docid16252 rev 15 247/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz electrical characteristics 281 14.2 absolute maximum ratings stresses above the absolute maximum ratings listed in table 45: voltage characteristics , table 46: current characteristics , and table 47: thermal characteristics may cause permanent damage to the device. these are stress ratings only and functional operation of the device at these conditions is not implied. exposure to maximum rating conditions for extended periods may af fect device reliability. table 45. voltage characteristics ratings min. max. unit regulator input voltage (vdd_pads) -0.3 +3.6 v analog, memory and core voltage (vdd_24mhz, vdd_vco, vdd_rf, vdd_if, vdd_padsa, vdd_mem, vdd_pre, vdd_synth, vdd_core) -0.3 +2.0 v voltage on rf_p,n; rf_tx_alt_p,n -0.3 +3.6 v rf input power (for max level for correct packet reception see table 67: receive characteristics ) rx signal into a lossless balun ? +15 dbm voltage on any gpio (pa[7:0] , pb[7:0], pc[7:0]), swclk, nrst, vreg_out -0.3 vdd_pads +0.3 v voltage on bias_r, osc_out, osc_in -0.3 vdd_padsa +0.3 v table 46. current characteristics symbol ratings max. unit i vdd total current into v dd /v dda power lines (source) 150 ma i vss total current out of v ss ground lines (sink) 150 i io output current sunk by any i/o and control pin 25 output current source by any i/os and control pin ? 25 i inj(pin) injected current on nrst pin 5 injected current on hse osc_in and lse osc_in pins 5 injected current on any other pin 5 i inj(pin) total injected current (sum of all i/o and control pins) 25 table 47. thermal characteristics symbol ratings value unit t stg storage temperature range ?40 to +140 c t j maximum junction temperature 150 c
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 248/285 docid16252 rev 15 14.3 operating conditions 14.3.1 general operating conditions 14.3.2 operating condi tions at power-up power-on resets (por hv and por lv) the stm32w108 measures the voltage levels supplied to the three power domains. if a supply voltage drops below a low threshold, then a reset is applied. the reset is released if the supply voltage rises above a high threshold. there are three detection circuits for power on reset as follows: ? por hv monitors the always on domain supply voltage. thresholds are given in table 49 . ? por lvcore monitors the core domain supply voltage. thresholds are given in table 50 . ? por lvmem monitors the memory supply voltage. thresholds are given in table 51 . table 48. general operating conditions symbol parameter min. typ. max. unit ? regulator input voltage (vdd_pads) 2.1 ? 3.6 v ? analog and memory input voltage (vdd_24mhz, vdd_vco, vdd_rf, vdd_if, vdd_padsa, vdd_mem, vdd_pre, and vdd_synth) 1.7 1.8 1.9 v ? core input voltage (vdd_core) 1.18 1.25 1.32 v t oper operating temperature range -40 ? +105 c table 49. por hv thresholds parameter test condit ions min typ max unit always-on domain release 1.0 1.2 1.4 v always-on domain assert 0.5 0.6 0.7 v supply rise time from 0.5 v to 1.7 v ? ? 250 s table 50. por lvcore thresholds parameter test condit ions min typ max unit 1.25 v domain release 0.9 1.0 1.1 v 1.25 v domain assert 0.8 0.9 1.0 v table 51. por lvmem thresholds parameter test condit ions min typ max unit 1.8 v domain release 1.35 1.5 1.65 v 1.8 v domain assert 1.26 1.4 1.54 v
docid16252 rev 15 249/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz electrical characteristics 281 the por lvcore and por lvmem reset sources are merged to provide a single reset source, por lv, to the reset generation module , since the detection of either event needs to reset the same system modules. nrst pin a single active low pin, nrst, is provided to reset the system. this pin has a schmitt triggered input. to afford good noise immunity and resistance to switch bounce, the pin is filtered with the reset filter module and generates the reset so urce rstb to the rese t generation module. 14.3.3 absolute maximum ratings (electrical sensitivity) based on three different tests (esd, lu) using specific measurement methods, the device is stressed in order to determ ine its performance in terms of electrical sensitivity. electrostatic discharge (esd) electrostatic discharges (a positive then a negative pulse separated by 1 second) are applied to the pins of each sample according to each pin combinati on. the sample size depends on the number of supply pins in the device (3 parts (n+1) supply pins). this test conforms to the jesd22-a114/c101 standard. table 52. reset filter specification for rstb parameter min typ max unit reset filter time constant 2.1 12.0 16.0 s reset pulse width to guarantee a reset 26.0 ? ? s reset pulse width guaranteed not to cause a reset 0 ? 1.0 s table 53. esd absolute maximum ratings symbol parameter conditions class maximum value (1) 1. based on characterization results, not tested in production. unit v esd(hbm) electrostatic discharge voltage (human body model) t a = +25 c in compliance with jesd22-a114 2 2000 (2) 2. value valid for all devices and al l pins except for the rf pins of the stm32w108cc and stm32w108cz devices. v electrostatic discharge voltage (human body model) for rf pins 1100 (3) 3. value valid only for stm32w108cc and stm32w108cz devices. v esd(cdm) electrostatic discharge voltage (charge device model) for all pins t a = +25 c in compliance with jesd22-a114 ii 500 v msl moisture sensitivity level ? ? msl3 ?
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 250/285 docid16252 rev 15 static latch-up two complementary static te sts are required on six pa rts to assess the latch-up performance: ? a supply overvoltage is applied to each power supply pin ? a current injection is applied to each input, output and configurable i/o pin these tests are compliant with eia/jesd 78a ic latch-up standard. table 54. electrical sensitivities symbol parameter conditions class lu static latch-up class t a = +105 c conforming to jesd78a ii level a
docid16252 rev 15 251/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz electrical characteristics 281 14.4 spi interface characteristics unless otherwise specified, the parameters given in table 55 for the spi are derived from tests performed under ambient temperature and v dd supply voltage conditions summarized in table 48: general operating conditions . table 55. spi characteristics symbol parameter conditions min max (1) 1. based on characterization, not tested in production. unit f sck 1/t c(sck) spi clock frequency master mode - 12 mhz slave mode - 5 duty(sck) duty cycle of spi clock frequency slave mode 30 70 % t r(sck) t f(sck) spi clock rise and fall time capacitive load: c = 15 pf - 8 ns t su(nss) nss setup time slave mode 2t pclk - t h(nss) nss hold time slave mode 2t pclk - t w(sckh) t w(sckl) sck high and low time master mode t csck / 2-2 t csck / 2+2 t su(mi) t su(si) data input setup time master mode 1 - slave mode 0 - t h(mi) t h(si) data input hold time master mode 1 - slave mode 0.25 - t a(so) (2) 2. min time is for the minimum time to drive the outpu t and max time is for the maximum time to validate the data. data output access time slave mode, f pclk = 12 mhz 0 2t pclk t dis(so) (3) 3. min time is for the minimum time to invalidate the output and max time is for the maximum time to put the data in hi-z. characterization values are related to stm32w108cc. data output disable time slave mode 0 36 t v(so) (1) t v(mo) (1) data output valid time slave mode (after enable edge) - 22 master mode (after enable edge) - 14.25 t h(so) (1) t h(mo) (1) data output hold time slave mode (after enable edge) 15.6 - master mode (after enable edge) 0 -
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 252/285 docid16252 rev 15 figure 55. spi timing diagram - slave mode and cpha = 0 figure 56. spi timing diagram - slave mode and cpha = 1 (1) 1. measurement points are done at cmos levels: 0.3v dd and 0.7v dd . a i141 3 4c s ck inp u t cpha= 0 mo s i input mi s o out p ut cpha= 0 m s bout m s bin bi t6 ou t l s bin l s bout cpol=0 cpol=1 bit1 in n ss inp u t t s u(n ss ) t c( s ck) t h(n ss ) t a ( s o) t w( s ckh) t w( s ckl) t v( s o) t h( s o) t r( s ck) t f( s ck) t di s ( s o) t su ( s i) t h( s i) a i141 3 5 s ck inp u t cpha=1 mo s i input mi s o out p ut cpha=1 m s bout m s bin bi t6 ou t l s bin l s bout cpol=0 cpol=1 bit1 in t s u(n ss ) t c( s ck) t h(n ss ) t a ( s o) t w( s ckh) t w( s ckl) t v( s o) t h( s o) t r( s ck) t f( s ck) t di s ( s o) t su ( s i) t h( s i) n ss inp u t
docid16252 rev 15 253/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz electrical characteristics 281 figure 57. spi timing diagram - master mode (1) 1. measurement points are done at cmos levels: 0.3v dd and 0.7v dd . a i141 3 6 s ck inp u t cpha= 0 mo s i output mi s o inp ut cpha= 0 m s bin m s b out bi t6 in l s b out l s b in cpol=0 cpol=1 b i t1 out n ss inp u t t c( s ck) t w( s ckh) t w( s ckl) t r( s ck) t f( s ck) t h(mi) high s ck inp u t cpha=1 cpha=1 cpol=0 cpol=1 t su (mi) t v(mo) t h(mo)
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 254/285 docid16252 rev 15 14.5 adc characteristics table 56 describes the key adc parameters measured at 25c and vdd_pads at 3.0 v, for a sampling clock of 1 mhz. hvselp and hvseln are programmed to 0 to disable the input buffer. the single-ended measurements were done at f input = 7.7% f nyquist ; 0 dbfs level (where full-scale is a 1.2 v p-p swing). the differential measurements were done at f input = 7.7% f nyquist ; -6 dbfs level (where full-s cale is a 2.4 v p-p swing). table 56. adc module key parameters for 1 mhz sampling (1) 1. inl and dnl are referenced to a lsb of the equivalent adc bits shown in the last row of table 56 . enob (effective number of bits) can be calculated from eit her snr (signal to non-harmonic noise ratio) or sinad (signal-to-noise and distortion ratio). parameter performance smp[2:0] 0 1 234567 conversion time (s) 32 64 128 256 512 1024 2048 4096 nyquist freq (khz) 15.6 7.81 3.91 1.95 0.977 0.488 0.244 0.122 3 db cut-off (khz) 9.43 4.71 2.36 1.18 0.589 0.295 0.147 0.0737 inl (codes peak) 0.083 0.092 0.163 0.306 0.624 1.229 2.451 4.926 inl (codes rms) 0.047 0.051 0.093 0.176 0.362 0.719 1.435 2.848 dnl (codes peak) 0.028 0.035 0.038 0.044 0.074 0.113 0.184 0.333 dnl (codes rms) 0.008 0.009 0.011 0.014 0.019 0.029 0.048 0.079 enob (from single-cycle test) 5.6 7.0 8.6 10.1 11.5 12.6 13.0 13.2 snr (db) single-ended differential 35 35 44 44 53 53 62 62 70 71 75 77 77 79 77 80 sinad (db) single-ended differential 35 35 44 44 53 53 61 62 67 70 69 75 70 76 70 76 sdfr (db) single-ended differential 59 60 68 69 72 77 72 80 72 81 72 81 72 81 73 81 thd (db) single-ended differential -45 -45 -54 -54 -62 -63 -67 -71 -69 -75 -69 -76 -69 -76 - 69 -76 enob (from snr) single-ended differential 5.6 5.6 7.1 7.1 8.6 8.6 10.0 10.1 11.3 11.4 12.2 12.5 12.4 12.9 12.5 12.9 enob (from sinad) single-ended differential 5.5 5.6 7.0 7.0 8.5 8.5 9.9 10.0 10.9 11.3 11.2 12.1 11.3 12.3 11.3 12.4 equivalent adc bits 7 [15:9] 8 [15:8] 9 [15:7] 10 [15:6] 11 [15:5] 12 [15:4] 13 [15:3] 14 [15:2]
docid16252 rev 15 255/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz electrical characteristics 281 table 57 describes the key adc parameters measured at 25c and vdd_pads at 3.0 v, for a sampling rate of 6 mh z. hvselp and hvseln are progr ammed to 0 to disable the input buffer. the single-ended measurements were done at f input = 7.7% f nyquist ; 0 dbfs level (where full-scale is a 1.2 v p-p swing). the differential measurements were done at f input = 7.7% f nyquist ; -6 dbfs level (where full-scale is a 2.4 v p-p swing) and a common mode voltage of 0.6 v. table 57. adc module key parameters for input buffer disabled and 6 mhz sampling (1) 1. inl and dnl are referenced to a lsb of the equivalent adc bits shown in the last row of table 57 . enob (effective number of bits) can be calculated from eith er snr (signal to non-harmonic noise ratio) or sinad (signal-to-noise and distortion ratio). parameter performance smp[2:0] 0 1 2 3 4 5 6 7 conversion time (s) 5.33 10.7 21.3 42.7 85.3 171 341 683 nyquist freq (khz) 93.8 46.9 23.4 11.7 5.86 2.93 1.47 0.732 3 db cut-off (khz) 56.6 28.3 14.1 7.07 3.54 1.77 0.884 0.442 inl (codes peak) 0.084 0.084 0.15 0.274 0.518 1.057 2.106 4.174 inl (codes rms) 0.046 0.044 0.076 0.147 0.292 0.58 1.14 2.352 dnl (codes peak) 0.026 0.023 0.044 0.052 0.096 0.119 0.196 0.371 dnl (codes rms) 0.007 0.009 0.013 0.015 0.024 0.03 0.05 0.082 enob (from single-cycle test) 5.6 7. 0 8.5 10.0 11.4 12.6 13.1 13.2 snr (db) single-ended differential 35 35 44 44 53 53 62 62 70 71 75 77 76 79 77 80 sinad (db) single-ended differential 35 35 44 44 53 53 62 62 68 70 71 75 71 77 71 77 sdfr (db) single-ended differential 60 60 68 69 75 77 75 80 75 80 75 80 75 80 75 80 thd (db) single-ended differential -45 -45 -54 -54 -63 -63 -68 -71 -70 -76 -70 -77 -70 -78 -70 -78 enob (from snr) single-ended differential 5.6 5.6 7.1 7.1 8.6 8.6 10.0 10.1 11.4 11.5 12.1 12.5 12.4 12.9 12.5 13.0 enob (from sinad) single-ended differential 5.5 5.6 7.0 7.1 8.5 8.6 9.9 10.1 11.0 11.4 11.4 12.4 11.5 12.8 11.5 13.0 equivalent adc bits 5 [15:11] 6 [15:10] 7 [15:9] 8 [15:8] 9 [15:7] 10 [15:6] 11 [15:5] 12 [15:4]
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 256/285 docid16252 rev 15 table 58 describes the key adc parameters measured at 25c and vdd_pads at 3.0 v, for a sampling rate of 6 mh z. hvselp and hvseln are progr ammed to 1 to enable the input buffer. the single-ended measurements were done at f input = 7.7% f nyquist , level = 1.2 v p-p swing centered on 1.5 v. the differential measurements were done at f input =7.7% f nyquist , level = 1.2 v p-p swing and a common mode voltage of 1.5 v. table 58. adc module key parameters for input buffer enabled and 6mhz sampling (1) 1. inl and dnl are referenced to a lsb of the equivalent adc bits shown in the last row of table 58 . enob (effective number of bits) can be calculated from either snr (signal to non-harmonic noise ratio) or sinad (signal-to-noise and distortion ratio). parameter performance smp[2:0] 0 1 2 3 4 5 6 7 conversion time (s) 32 64 128 256 512 1024 2048 4096 nyquist freq (khz) 93.8 46.9 23. 4 11.7 5.86 2.93 1.47 0.732 3 db cut-off (khz) 56.6 28.3 14.1 7.07 3.54 1.77k 0.884 0.442 inl (codes peak) 0.055 0.032 0.03 8 0.07 0.123 0.261 0.522 1.028 inl (codes rms) 0.028 0.017 0. 02 0.04 0.077 0.167 0.326 0.65 dnl (codes peak) 0.028 0.017 0.02 0.04 0.077 0.167 0.326 0.65 dnl (codes rms) 0.01 0.006 0.00 6 0.007 0.008 0.013 0.023 0.038 enob (from single- cycle test) 3.6 5.0 6.6 8.1 9.5 10.7 11.3 11.6 snr (db) single-ended differential 23 23 32 32 41 41 50 50 59 59 65 66 67 69 68 71 sinad (db) single-ended differential 23 23 32 32 41 41 50 50 58 59 64 66 66 69 66 71 sdfr (db) single-ended differential 48 48 56 57 65 65 72 74 72 82 72 88 73 88 73 88 thd (db) single-ended differential -33 -33 -42 -42 -51 -51 -59 -60 -66 -69 -68 -76 -68 -80 -68 -82 enob (from snr) single-ended differential 3.6 3.6 5.1 5.1 6.6 6.6 8.1 8.1 9.5 9.5 10.5 10.7 10.9 11.3 11 11.5 enob (from sinad) single-ended differential 3.6 3.6 5.0 5.1 6.5 6.6 8.0 8.0 9.4 9.5 10.3 10.6 10.7 11.3 10.7 11.4 equivalent adc bits 7 [ 15:9] 8 [15:8] 9 [15:7] 10 [15:6] 11 [15:5] 12 [15:4] 13 [15:3] 14 [15:2]
docid16252 rev 15 257/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz electrical characteristics 281 table 59 lists other specifications for the adc not covered in table 56 , table 57 , and table 58 . note: the signal-ended adc measurements are limited in their range and only guaranteed for accuracy within the limits shown in this ta ble. the adc's intern al design allows for measurements outside of this range (200 mv) when the input buffer is disabled, but the accuracy of such measurements is not guaranteed. the maximum input voltage is of more interest to the differential sampling where a di fferential measurement might be small, but a common mode can push the actual input voltage on one of the signals towards the upper voltage limit. table 59. adc characteristics parameter min. typ. max. units vref 1.17 1.2 1.35 v vref output current ? ? 1 ma vref load capacitance ? ? 10 nf external vref voltage range 1.1 1.2 1.3 v external vref input impedance 1 ? ? m minimum input voltage input buffer disabled input buffer enabled 0 0.1 ? ? ? ? v maximum input voltage input buffer disabled input buffer enabled ? ? ? ? vref vdd_pads - 0.1 v single-ended signal range input buffer disabled input buffer enabled 0 0.1 ? ? vref vdd_pads ? 0.1 v differential signal range input buffer disabled input buffer enabled -vref -vdd_pads + 0.1 ? ? +vref +vdd_pads - 0.1 v common mode range input buffer disabled input buffer enabled 0 vdd_pads/2 vref v input referred adc offset -10 ? 10 mv input impedance 1 mhz sample clock 6 mhz sample clock not sampling 1 0.5 10 ? ? ? ? ? ? m
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 258/285 docid16252 rev 15 14.6 clock frequencies 14.6.1 high frequency internal clock characteristics 14.6.2 high frequency extern al clock characteristics table 60. high-frequency rc oscillator characteristics parameter test conditions min. typ. max. unit frequency at reset 6 12 20 mhz frequency steps 0.5 mhz duty cycle 40 60 % supply dependence change in supply = 0.1 v test at supply changes: 1.8 v to 1.7 v 5 % table 61. high-frequency crystal oscillator characteristics parameter test conditions min. typ. max. unit frequency ? ? 24 ? mhz accuracy ? -40 ? +40 ppm duty cycle ? 40 ? 60 % phase noise (at 100 khz offset) ? ? ? -120 dbc/hz start-up time at max bias ? ? ? 1 ms start up time at optimal bias ? ? ? 2 ms current consumption ? ? 200 300 a current consumption at max bias ? ? ? 1 ma crystal with high esr ? ? ? 100 ? load capacitance ? ? ? 10 pf ? crystal capacitance ? ? ? 7 pf ? crystal power dissipation ? ? ? 200 w crystal with low esr ? ? ? 60 ? load capacitance ? ? ? 18 pf ? crystal capacitance ? ? ? 7 pf ? crystal power dissipation ? ? ? 1 mw
docid16252 rev 15 259/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz electrical characteristics 281 14.6.3 low frequency intern al clock characteristics 14.6.4 low frequency exter nal clock characteristics table 62. low-frequency rc oscillator characteristics parameter test conditio ns min. typ. max. unit nominal frequency after trimming 9 10 11 khz analog trim step size ? ? 1 ? khz supply dependence for a voltage drop from 3.6 v to 3.1 v or 2.6 v to 2.1 v (without re-calibration) ??1% frequency dependence frequency variation with temperature for a change from -40 oc to +85oc (without re-calibration) ?2?% table 63. low-frequency crysta l oscillator characteristics parameter test condit ions min. typ. max. unit frequency ? ? 32.768 ? khz accuracy initial, temperature, and ageing -100 ? +100 ppm load cap xin ? ? 27 ? pf load cap xout ? ? 18 ? pf crystal esr ? ? ? 100 k start-up time ? ? ? 2 s current consumption at 25c, vdd_pads = 3.0 v ? ? 0.5 a
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 260/285 docid16252 rev 15 14.7 dc electrical characteristics table 64. dc electrical characteristics parameter conditions min. typ. max. unit regulator input voltage (vdd_pads) 2.1?3.6v power supply range (vdd_mem) regulator output or external input 1.7 1.8 1.9 v power supply range (vdd_core) regulator output 1.18 1.25 1.32 v deep sleep current (1) quiescent current, internal rc oscillator disabled -40c, vdd_pads = 3.6 v ? 0.4 ? a +25c, vdd_pads = 3.6 v ? 0.4 ? a +85c, vdd_pads = 3.6 v ? 1.2 ? a +105c, vdd_pads = 3.6 v ? 2.5 ? a quiescent current, including internal rc oscillator -40c, vdd_pads = 3.6 v ? 0.7 ? a +25c, vdd_pads = 3.6 v ? 0.7 1.0 a +85c, vdd_pads = 3.6 v ? 1.5 ? a +105c, vdd_pads = 3.6 v ? 2.9 5.5 a quiescent current, including 32.768 khz oscillator -40c, vdd_pads = 3.6 v ? 0.8 ? a +25c, vdd_pads = 3.6 v ? 1.0 ? a +85c, vdd_pads = 3.6 v ? 2.1 ? a +105c, vdd_pads = 3.6 v ? 3.5 ? a quiescent current, including internal rc oscillator and 32.768 khz oscillator -40c, vdd_pads = 3.6 v ? 1.1 ? a +25c, vdd_pads = 3.6 v ? 1.3 ? a +85c, vdd_pads = 3.6 v ? 2.5 ? a +105c, vdd_pads = 3.6 v ? 3.9 ? a simulated deep sleep (debug mode) current with no debugger activity ? 300 ? a reset current quiescent current, nrst asserted typ at 25c/3 v max at 85c/3.6 v ?1.22.0ma processor and peripheral currents arm ? cortex-m3, ram, and flash memory 25 c, 1.8 v memory and 1.25 v core arm ? cortex-m3 running at 12 mhz from crystal oscillator radio and all peripherals off ?6.0?ma
docid16252 rev 15 261/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz electrical characteristics 281 arm ? cortex-m3, ram, and flash memory 25 c, 1.8 v memory and 1.25 v core arm ? cortex-m3 running at 24 mhz from crystal oscillator radio and all peripherals off ?7.5?ma arm ? cortex-m3, ram, and flash memory sleep current 25 c, 1.8 v memory and 1.25 v core arm ? cortex-m3 clocked at 12 mhz from the crystal oscillator radio and all peripherals off ?3.0?ma arm ? cortex-m3, ram, and flash memory sleep current 25 c, 1.8 v memory and 1.25 v core arm ? cortex-m3 clocked at 6 mhz from the high frequency rc oscillator radio and all peripherals off ?2.0?ma serial controller current for each controller at maximum data rate ?0.2?ma general purpose timer current for each timer at maximum clock rate ?0.25?ma general purpose adc current at maximum sample rate, dma enabled ?1.1?ma rx current radio receiver, mac, and baseband arm ? cortex-m3 sleeping ? 22.0 ? ma total rx current ( = i radio receiver, mac and baseband, cpu + i ram, and flash memory ) vdd_pads = 3.0 v, 25 c, arm ? cortex-m3 running at 12 mhz ?25.0?ma vdd_pads = 3.0 v, 25 c, arm ? cortex-m3 running at 24 mhz ?26.5?ma boost mode total rx current ( = i radio receiver, mac and baseband, cpu + i ram, and flash memory ) vdd_pads = 3.0 v, 25 c, arm ? cortex-m3 running at 12 mhz ?27.0?ma vdd_pads = 3.0 v, 2 5c, arm ? cortex-m3 running at 24 mhz ?28.5?ma tx current radio transmitter, mac, and baseband 25 c and 1.8 v core; max. power out (+3 dbm typical) arm ? cortex-m3 sleeping ?26.0?ma table 64. dc electrical ch aracteristics (continued) parameter conditions min. typ. max. unit
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 262/285 docid16252 rev 15 total tx current ( = i radio transmitter, mac and baseband, cpu + i ram, and flash memory ) vdd_pads = 3.0 v, 25 c; maximum power setting (+7 dbm); arm ? cortex-m3 running at 12 mhz ?42.0?ma vdd_pads = 3.0 v, 25 c; +3 dbm power setting; arm ? cortex-m3 running at 12 mhz ?29.5?ma vdd_pads = 3.0 v, 25 c; 0dbm power setting; arm ? cortex-m3 running at 12 mhz ?27.0?ma vdd_pads = 3.0 v, 25 c; minimum power setting; arm ? cortex-m3 running at 12 mhz ?21.0?ma vdd_pads = 3.0 v, 25 c; maximum power setting (+7 dbm); arm ? cortex-m3 running at 24 mhz ?43.5?ma vdd_pads = 3.0 v, 25 c; +3 dbm power setting; arm ? cortex-m3 running at 24 mhz ?31.0?ma vdd_pads = 3.0 v, 25 c; 0dbm power setting; arm ? cortex-m3 running at 24 mhz ?28.5?ma vdd_pads = 3.0 v, 25 c; minimum power setting; arm ? cortex-m3 running at 24 mhz ?22.5?ma 1. 105c values are valid only for stm32w108cc and stm32w108cz products. table 64. dc electrical ch aracteristics (continued) parameter conditions min. typ. max. unit
docid16252 rev 15 263/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz electrical characteristics 281 figure 58 shows the variation of current in transmit mode (with the arm ? cortex-m3 running at 12 mhz). figure 58. transmit power consumption
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 264/285 docid16252 rev 15 figure 59 shows typical output power against power setting on the st reference design. figure 59. transmit output power
docid16252 rev 15 265/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz electrical characteristics 281 14.8 digital i/o specifications table 65 lists the digital i/o specifications for the stm32w. the digital i/o power (named vdd_pads) comes from three dedicated pins (pins 23, 28 and 37). the voltage applied to these pins sets the i/o voltage. table 65. digital i/o characteristics parameter conditions min. typ. max. unit voltage supply (regulator input) vdd_pads 2.1 ? 3.6 v low schmitt switching threshold v swil schmitt input threshold going from high to low 0.42 x vdd_pad s ? 0.50 x vdd_pad s v high schmitt switching threshold v swih schmitt input threshold going from low to high 0.62 x vdd_pad s ? 0.80 x vdd_pad s v input current for logic 0 i il ??-0.5 a input current for logic 1 i ih ??+0.5 a input pull-up resistor value r ipu 24 29 34 k input pull-down resistor value r ipd 24 29 34 k output voltage for logic 0 v ol (i ol = 4 ma for standard pads, 8 ma for high current pads) 0? 0.18 x vdd_pad s v output voltage for logic 1 v oh (i oh = 4 ma for standard pads, 8 ma for high current pads) 0.82 x vdd_pad s ? vdd_pad s v output source current (standard current pad) i ohs ??4ma output sink current (standard current pad) i ols ??4ma output source current high current pad: pa6, pa7, pb6, pb7, pc0 i ohh ??8ma output sink current high current pad: pa6, pa7, pb6, pb7, pc0 i olh ??8ma total output current (for i/o pads) i oh + i ol ??40 ma input voltage threshold for osc32_out 0.2 x vdd_pad s ? 0.8 x vdd_pad s v input voltage threshold for osc_out 0.2 x vdd_pad sa ? 0.8 x vdd_pad sa v
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 266/285 docid16252 rev 15 14.9 non-rf system el ectrical characteristics table 66 lists the non-rf s ystem level characteristics for the stm32w. 14.10 rf electrical characteristics 14.10.1 receive table 67 lists the key parameters of the integrat ed ieee 802.15.4 rece iver on the stm32w. note: receive measurements were collected with st?s stm32w ceramic balun reference design (version a0) at 2440 mhz. the typical number indicates one standard deviation above the mean, measured at room temperature (25 c). the min and max numbers were measured over process corners at room temperature table 66. non-rf system electrical characteristics parameter conditions min. typ. max. unit system wakeup time from deep sleep from wakeup event to first arm ? cortex-m3 instruction running from 6mhz internal rc clock includes supply ramp time and oscillator startup time ?110? s shutdown time going into deep sleep from last arm ? cortex-m3 instruction to deep sleep mode ?5?s table 67. receive characteristics parameter conditions min. typ. max. unit frequency range 2400 ? 2500 mhz sensitivity (boost mode) 1% per, 20 byte packet defined by ieee 802.15.4-2003 ? -102 -96 dbm sensitivity 1% per, 20 byte packet defined by ieee 802.15.4-2003 ? -100 -94 dbm high-side adjacent channel rejection ieee 802.15.4 signal at -82 dbm ?35?db low-side adjacent channel rejection ieee 802.15.4 signal at -82 dbm ?35?db 2 nd high-side adjacent channel rejection ieee 802.15.4 signal at -82 dbm ?46?db 2 nd low-side adjacent channel rejection ieee 802.15.4 signal at -82 dbm ?46?db channel rejection for all other channels ieee 802.15.4 signal at -82 dbm ?40?db 802.11g rejection centered at +12 mhz or -13 mhz ieee 802.15.4 signal at -82 dbm ?36?db
docid16252 rev 15 267/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz electrical characteristics 281 14.10.2 transmit table 68 lists the key parameters of the inte grated ieee 802.15.4 transmitter on the stm32w. note: transmit measurements were collected with st?s stm32w ceramic balun reference design (version a0) at 2440 mhz. the typical number indicates one standard deviation above the mean, measured at room temperature (25 c). the min and max numbers were measured over process corners at room temperature maximum input signal level for correct operation 0??dbm co-channel rejection ieee 802.15.4 signal at -82 dbm ?-6?dbc relative frequency error (2x40 ppm required by ieee 802.15.4) -120 ? +120 ppm relative timing error (2x40 ppm required by ieee 802.15.4) -120 ? +120 ppm linear rssi range as defin ed by ieee 802.15.4 40 ? ? db rssi range -90 ? -40 dbm table 67. receive characteristics (continued) parameter conditions min. typ. max. unit table 68. transmit characteristics parameter conditions min. typ. max. unit maximum output power (boost mode) at highest power setting ? 8 ? dbm maximum output power at highest power setting 1 5 ? dbm minimum output power at lowest power setting ? -55 ? dbm error vector magnitude as defined by ieee 802.15.4, which sets a 35% maximum ?515% carrier frequency error -40 ? +40 ppm psd mask relative 3.5 mhz away -20 ? ? db psd mask absolute 3.5 mhz away -30 ? ? dbm
electrical characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 268/285 docid16252 rev 15 14.10.3 synthesizer table 69 lists the key parameters of the integrated synthesizer on the stm32w. table 69. synthesizer characteristics parameter conditions min. typ. max. unit frequency range 2400 ? 2500 mhz frequency resolution ? 11.7 ? khz lock time from off, with correct vco dac setting ??100 s relock time channel change or rx/tx turnaround (ieee 802.15.4 defines 192 s turnaround time) ??100 s phase noise at 100 khz offset ? -71 ? dbc/hz phase noise at 1 mhz offset ? -91 ? dbc/hz phase noise at 4 mhz offset ? -103 ? dbc/hz phase noise at 10 mhz offset ? -111 ? dbc/hz
docid16252 rev 15 269/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz package characteristics 281 15 package characteristics in order to meet environmental requirements, st offers these devices in different grades of ecopack ? packages, depending on their level of environmental compliance. ecopack ? specifications, grade definitions a nd product status are available at: www.st.com . ecopack ? is an st trademark. figure 60. vfqfpn48 7x7mm package outline 1. drawing is not to scale. seating plane c a3 a1 a2 a ddd c pin no. 1 id r = 0.20 bottom view 1 48 e e l l 12 13 d2 b 24 25 b e2 36 37 e d v0_me
package characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 270/285 docid16252 rev 15 figure 61. vfqfpn48 7x7mm recommended footprint (dimensions in mm) 1. drawing is not to scale. table 70. vfqfpn48 7x7mm package mechanical data symbol millimeters inches (1) 1. values in inches are converted from mm and rounded to 4 decimal digits. min. typ. max. min. typ. max. a 0.800 0.900 1.000 0.0315 0.0354 0.0394 a1 0.020 0.050 0.0008 0.0020 a2 0.650 1.000 0.0256 0.0394 a3 0.250 0.0098 b 0.180 0.230 0.300 0. 0071 0.0091 0.0118 d 6.850 7.000 7.150 0.2697 0.2756 0.2815 d2 2.250 4.700 5.250 0.0886 0.1850 0.2067 e 6.850 7.000 7.150 0.2697 0.2756 0.2815 e2 2.250 4.700 5.250 0.0886 0.1850 0.2067 e 0.450 0.500 0.550 0.0177 0.0197 0.0217 l 0.300 0.400 0.500 0.0118 0.0157 0.0197 ddd 0.080 0.0031 7. 3 0 7. 3 0 0.20 0. 3 0 0.55 0.50 5. 8 0 6.20 6.20 5.60 5.60 5. 8 0 0.75 a i15697 4 8 1 12 1 3 24 25 3 6 3 7
docid16252 rev 15 271/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz package characteristics 281 figure 62. vfqfpn40 6x6mm pitch 0.5 package outline 1. drawing is not to scale. table 71. vfqfpn40 6x6mm package mechanical data symbol millimeters inches (1) 1. values in inches are converted from mm and rounded to 4 decimal digits. min typ max min typ max a 0.800 0.900 1.000 0.0315 0.0354 0.0394 a1 0.020 0.050 0.0008 0.0020 a2 0.720 1.070 0.0283 0.0421 a3 0.200 0.0079 b 0.180 0.250 0.300 0. 0071 0.0098 0.0118 d 5.900 6.000 6.100 0.2323 0.2362 0.2402 d2 4.500 4.550 4.700 0.1772 0.1791 0.1850 e 6.000 0.2362 e2 4.500 4.550 4.700 0.1772 0.1791 0.1850 e 0.500 0.0197 l 0.350 0.400 0.450 0.0138 0.0157 0.0177 ddd 0.080 0.0031 bottom view expo s ed p a d top view pin 1 id pin 1 id zf_me
package characteristics stm32w108hb stm32w108cc stm32w108cb stm32w108cz 272/285 docid16252 rev 15 figure 63. ufqfpn48 7x7 mm pitch 0.5 package outline 1. drawing is not to scale. 2. all leads/pads should also be soldered to the pcb to improve the lead/pad solder joint life. 3. there is an exposed die pad on the underside of t he ufqfpn package. it is recommended to connect and solder this back-sidepad to pcb ground. a0b9_me_v3 d pin 1 indentifier laser marking area ee d y d2 e2 exposed pad area z 1 48 detail z r 0.125 typ. 1 48 l c 0.500x45 pin1 corner a seating plane a1 b e ddd detail y t
docid16252 rev 15 273/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz package characteristics 281 figure 64. ufqfpn48 7x7 mm recommended footprint (dimensions in mm) 1. drawing is not to scale. table 72. ufqfpn48 ?7x7 mm pitch 0.5 package mechanical data symbol millimeters inches (1) 1. values in inches are converted from mm and rounded to 4 decimal digits. min typ max typ min max a 0.500 0.550 0.600 0.0197 0.0217 0.0236 a1 0.000 0.020 0.050 0.0000 0.0008 0.0020 d 6.900 7.000 7.100 0.2717 0.2756 0.2795 e 6.900 7.000 7.100 0.2717 0.2756 0.2795 l 0.300 0.400 0.500 0.0118 0.0157 0.0197 t 0.152 0.0060 b 0.200 0.250 0.300 0.0079 0.0098 0.0118 e 0.500 0.0197 7. 3 0 7. 3 0 0.20 0. 3 0 0.55 0.50 5. 8 0 6.20 6.20 5.60 5.60 5. 8 0 0.75 a i15697 4 8 1 12 1 3 24 25 3 6 3 7
ordering information scheme stm32w108hb stm32w108cc stm32w108cb stm32w108cz 274/285 docid16252 rev 15 16 ordering information scheme example : stm32 w 108 c b u 6 x device family stm32 = arm-based 32-bit microcontroller product type w = wireless system-on-chip sub-family 108 = ieee 802.15.4 specification pin count h = 40 pins c = 48 pins code size b = 128 kbytes of flash memory c = 256 kbytes of flash memory z = 192 kbytes of flash memory package u = fqfpn temperature range 6 = ?40 c to +85 c 7 = ?40 c to +105 c enabled protocol stack ?blank? = development sample platform (1) 1. this p/n is under specific or dering conditions. please refer to your nearest st sales office. 1 = ember zigbee stack (2) 2. the ember zigbee stack is avai lable on 128 kbyte devices only. 3 = rf4ce stack 4 = ieee 802.15.4 media access control
docid16252 rev 15 275/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz ordering information scheme 281 for a list of available options (speed, package, etc.) or for further information on any aspect of this device, please contact your nearest st sales office.
revision history stm32w108hb stm32w108cc stm32w108cb stm32w108cz 276/285 docid16252 rev 15 17 revision history table 73. document revision history date revision changes 16-sep-2009 1 initial release. 21-sep-2009 2 modified document status to preliminary data. 24-nov-2009 3 major revision of section 1.2: overview on page 16 and section 9: serial interfaces on page 109 . added section 2: documentation conventions on page 18 , section 4: embedded memory on page 31 and section 7: integrated voltage regulator on page 89 . 01-mar-2010 4 updated section 11.1.8: calibration on page 229 . added notes to software reset on page 48 , section 9.6.1: setup and configuration on page 123 and section 11: analog-to-digital converter on page 223 . updated parameters and values in table 48: general operating conditions on page 248 . 22-sep-2010 5 added section 13.1: stm32w108 jtag tap connection on page 245 and section 6.4.5: slow timer (mac timer, watchdog, and sleeptimer) control and status registers on page 64 . added total tx current values for 24 mhz in table 64: dc electrical characteristics on page 260 and updated figure 58: transmit power consumption on page 263 . 20-oct-2010 6 updated table 56: adc module key parameters for 1 mhz sampling and table 57: adc module key parameters for input buffer disabled and 6 mhz sampling . added table 58: adc module key parameters for input buffer enabled and 6mhz sampling . modified system wakeup time from deep sleep in table 66: non-rf system electrical characteristics . 09-dec-2010 7 updated datasheet status to full datasheet. 29-mar-2011 8 added int_sleeptmrfl ag, int_sleeptmrcfg, sleeptmr_clken. 27-jul-2011 9 update for stm32w108cc and stm32w108cz 30-sep-2011 10 added note 2 in section figure 63.: ufqfpn48 7x7 mm pitch 0.5 package outline . 05-dec-2011 11 updated document title section 4.2: flash memory : replaced 1000 with 10k write/erase cycles. section 10.3.10: timer x capt ure/compare enable register (timx_ccer) : updated names of bits 12, 8, 4, and 0. figure 51: adc block diagram : added footnote 1 . section 11.1.4: offset/gain correction : added third bullet point about the offset/gain corrected value; added hv buffer offset calculation for stm32w108cc and stm32w108cz devices. table 39: typical adc input configurations : added footnote 1 .
docid16252 rev 15 277/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz revision history 281 05-dec-2011 11 table 41: adc gain and offset correction equations : replaced table with new gain and offset correction values and updated ?equation notes? below table. table 120: adc control register (adc_cr) : added ?note? to bit [11]. table 48: general operating conditions : operating temperature range max value changed to 105 c. table 53: esd absolute maximum ratings : updated v esd(hbm) and v esd(cdm) values and added footnote 3 . table 64: dc electrical characteristics : updated typ values of each 85 c condition; added 105 c condition. 15-dec-2011 12 table 53: esd absolute maximum ratings : changed column title ?ratings? to ?parameter?; added footnote 2 ; updated footnote 3 ; removed note for max value of v esd(cdm) . 09-mar-2012 13 added package ufqfpn48. 03-sep-2012 14 terminology-related changes renamed following registers (and their constituent bits): int_scxflag to scx_isr (updated bit descriptions) int_scxcfg to scxier (updated bit descriptions) scx_intmode to scx_icr (updated bit descriptions) scx_mode to scx_cr (updated bit descriptions) scx_data to scx_dr (updated bit descriptions) scx_ratelin to scx_crr1 (updated bit descriptions) scx_rateexp to scx_crr2 (updated bit descriptions) scx_spistat to scx_spisr (updated bit descriptions) scx_spicfg to scx_spicr (updated bit descriptions) scx_twistat to scx_i2csr (updated bit descriptions) scx_twictrl1 to scx_i2ccr1 (updated bit descriptions) scx_twictrl2 to scx_i2ccr2 (updated bit descriptions) sc1_uartstat to sc1_uartsr (updated bit descriptions) sc1_uartcfg to sc1_uartcr (updated bit descriptions) sc1_uartper to sc1_uartbrr1 sc1_uartfrac to sc1_uartbrr2 (updated bit descriptions) scx_dmastat to scx_dmasr (updated bit descriptions) scx_dmactrl to scx_dmacr (updated bit descriptions) scx_txbega to scx_dmat xbegaddar (updated bit descriptions) scx_txbegb to scx_dmat xbegaddbr (updated bit descriptions) scx_txenda to scx_dmatxendaddar (updated bit descriptions) scx_txendb to scx_dmatxendaddbr (updated bit descriptions) scx_txcnt to scx_dmatxcntr (updated bit descriptions) scx_rxbega to scx_dmarxbegaddar (updated bit descriptions) scx_rxbegab to scx_dmar xbegaddbr (updated bit descriptions) scx_rxenda to scx_dmarxendaddar (updated bit descriptions) table 73. document revision history (continued) date revision changes
revision history stm32w108hb stm32w108cc stm32w108cb stm32w108cz 278/285 docid16252 rev 15 03-sep-2012 14 (continued) scx_rxendb to scx_dmarxendaddbr (updated bit descriptions) scx_rxcnta to scx_dmarxcntar (updated bit descriptions) scx_rxcntb to scx_dmarxcntbr (updated bit descriptions) scx_rxcntsaved to scx_dmarxcntsavedr (updated bit descriptions) scx_rxerra to scx_dmarxerrar (updated bit descriptions) scx_rxerrb to scx_dmarxerrbr (updated bit descriptions) sleeptmr_cfg to slptmr_cr (updated bit descriptions) sleeptmr_cnth to slptmr_cnth sleeptmr_cntl to slptmr_cntl sleeptmr_cmpah to slpt mr_cmpah (updated bit descriptions) sleeptmr_cmpal to slptmr_cmpal (updated bit description) sleeptmr_cmpbh to slptmr_cmpbh (updated bi t description) sleeptmr_cmpbl to slptmr_cm pbl (updated bit description) int_sleeptmrflag to slptmr_isr (updated bit description) int_sleeptmrcfg to slptmr_ier (updated bit description) sleeptmr_clken to clk_sleep cr (updated bit descriptions) int_timxcfg to timx_ier int_timxflag to timx_isr int_timxmiss to timx_missr gpio_pxcfgl to gpiox_crl (updated bit descriptions) gpio_pxcfgh to gpiox_crh (updated bit descriptions) gpio_pxin to gpiox_idr (updated bit descriptions) gpio_pxout to gpiox_odr (updated bit descriptions) gpio_pxclr to gpiox_brr (updated bit descriptions) gpio_pxset to gpiox_bsr (updated bit descriptions) gpio_pxwake to pwr_wakepxr (updated bit descriptions) gpio_wakefilt to pwr_wakefiltr (updated bit descriptions) gpio_irqxsel to extix_cr (updated bit descriptions) gpio_intcfgx to extix_tsr (updated bit descriptions) int_gpioflag to exti_pr (updated bit descriptions) gpio_dbgcfg to gpio_dbgcr (updated bit descriptions) gpio_dbgstat to gpio_dbgsr (updated bit descriptions) adc_cfg to adc_cr adc_offset to adc_offsetr adc_gain to adc_gainr adc_dmacfg to adc_dmacr (updated bit descriptions) adc_dmastat to adc_dmasr adc_dmabeg to adc_dmamsar (updated bit descriptions) adc_dmasize to adc_dmandtr (updated bit descriptions) adc_dmacur to adc_dmamnar (updated bit descriptions) adc_dmacnt to adc_dmacndtr (updated bit descriptions) int_adcflag to adc_isr int_adccfg to adc_ier reset_event to rst_sr osc24m_ctrl to clk_hsecr2 (updated bit descriptions) cpu_clk_sel to clk_cpu_cr wdog_cfg to wdg_cr wdog_ctrl to wdg_kr wdog_restart to wdg_kicksr (added bit description) table 73. document revision history (continued) date revision changes
docid16252 rev 15 279/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz revision history 281 03-sep-2012 14 (continued) renamed the constituent bits of t he following registers throughout document: timx_cr1 timx_cr2 timx_smcr timx_egr timx_ccmr1 timx_ccmr2 timx_ccer timx_cnt timx_psc timx_arr timx_ccr1 timx_ccr2 timx_ccr3 timx_ccr4 tim1_or tim2_or renamed the following terms: osc32a to osc32_out, osc32b to osc32_in, osc32k to lse osc, clk32k to lse, oscrc to lsi10k, clk1k to lsi1k, osca to osc_out, oscb to osc_in, osc24m to hse osc, oschf to hsi, 24 mhz xtal to 24 mhz hse osc, 12 mhz rc to 12 mhz hsi rc, 10 khz rc to 10 khz lsi rc, 32 khz xtal to 32 khz hse osc updated terminology of figure 6: system module block diagram and figure 7: clocks block diagram . section 6.4.5 : replaced: enable bit with en, sleep_config with slptmr_cr, comp_a_h with cmpah, comp_a_l with cmpal, comp_b_h with cmpbh, comp_b_l with cmpbl. figure 10 : replaced scx_i2cstat, scx_i2cctrl1, and scx_i2cctrl2 with scx_i2csr, scx_i2ccr1, and scx_i2ccr2 respectively. section 10 : replaced tmrx with timx, tim_usr with usr, ccr1l with ccr1[15:0], ccr1h with ccr1[31:16], cnt with timx_cnt, cnt with cnt[15:0], ccr1 wit h timx_ccr1, timx_cc1r with timx_ccr1, tim_ccrx with timx_ccry, tim_cms with cms[1:0], ocxref with ocyr ef, tim_ccyif with ccyif, tim_smcr with timx_smcr, tim_ oc* with ocxy, and tim_ic* with icxy. generic changes updated ?reserved? bit descrip tions throughout document. removed all references to nvic. removed all references to the int_cfgset register, int_cfgclr register, and other registers originally in section 12: interrupts . removed all non-defined asterisks. specific changes section 1.2.1 : updated selectable voltage ranges of adc. added section 4.1: memory organization and memory map . added section 4.3.3 and section 4.3.4 . table 73. document revision history (continued) date revision changes
revision history stm32w108hb stm32w108cc stm32w108cb stm32w108cz 280/285 docid16252 rev 15 03-sep-2012 14 (continued) section 6.2.4 : added reset (rst) register map . section 6.3: clocks : added note beneath bullets points (before figure 7 ). section 6.3.6 : added low-speed internal 10 khz clock (lsi10k) control register (clk_lsi10kcr) , low-speed internal 1 khz clock control register (clk_lsi1kcr) , high-speed external clock control register 1 (clk_hsecr1) , high-speed internal clock control register (clk_hsicr) , high-speed external clock comparator register (clk_hsecompr) , clock period control register (clk_periodcr) , clock period status register (clk_periodsr) , clock dither control register (clk_dithercr) , high-speed external clock control register 2 (clk_hsecr2) , cpu clock control register (clk_cpucr) , clock switching (clk) register map . added section 6.4.5 . section 6.4.5 : added sleep timer force interrupt register (slptmr_ifr) , mactimer counter register (mactmr_cntr) , mactimer counter register (mactmr_cr) and mac timer (mactmr)/watchdog (wdg)/sleeptimer(slptmr) register map . section 6.5.1 : updated last bullet point. section 6.5.2 : updated bullet points. added section 6.5.5: power management registers . section 8.1.1 : updated paragraph concerning configuration registers. added table 8.5.10: pc trace or debug select register (gpio_pctracecr) . added table 8.5.13: general-purpose input/output (gpio) register map . section 9.4.1 : removed ?see table 86). table 22: spi master mode formats , table 24: spi slave mode formats , and figure 27: i2c master frame segments : updated heading lines and removed footnote. removed section 9.10: spi slave mode registers. section 9.12.5 to section 9.12.15 : bit ranges changed to [12:0]. added section 9.12.17: serial interf ace (sc1/sc2) register map . section 10.1.1 : updated prescaler section. section 10.3.8 and section 10.3.9 : separated register descriptions into ?output compare mode? and ?input capture mode?. added section 10.3.20: general-purpose timers 1 and 2 (tim1/tim2) register map . section 11.1.8 : updated information regarding the vdd_padsa regulator section 11.3.8 : bit range changed to [12:0]. section 11.3.10 : bit range changed to [13:1]. added section 11.3.12: analog-to-digital converter (adc) register map . section 12: interrupts : updated section and removed register descriptions. added section 12.2: management interrupt registers . added section 14.4: spi interface characteristics . table 73. document revision history (continued) date revision changes
docid16252 rev 15 281/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz revision history 281 03-sep-2012 14 (continued) table 64: dc electrical characteristics : added footnote 1 ; updated max quiescent current including internal rc oscillator values for 25 c and for 105 c. 20-sep-2013 15 replaced gpiox_waker by pwr_wakepxr, gpio_wakefr by pwr_wakefiltr, gpio_wake by gpio_sel, wake_sel by etxtix_cr and sel_gpio by gpio_sel in section 8: general- purpose input/output . changed vref max. value from 1.23 to 1.35 in table 59: adc characteristics . table 73. document revision history (continued) date revision changes
index stm32w108hb stm32w108cc stm32w108cb stm32w108cz 282/285 docid16252 rev 15 index a adc_cr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 233 adc_dmacndtr . . . . . . . . . . . . . . . . . . . . . 237 adc_dmacr . . . . . . . . . . . . . . . . . . . . . . . . 235 adc_dmamnar . . . . . . . . . . . . . . . . . . . . . . 237 adc_dmamsar . . . . . . . . . . . . . . . . . . . . . . 236 adc_dmandtr . . . . . . . . . . . . . . . . . . . . . . 236 adc_dmasr . . . . . . . . . . . . . . . . . . . . . . . . 235 adc_gainr . . . . . . . . . . . . . . . . . . . . . . . . . 234 adc_ier . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 adc_isr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 232 adc_offsetr . . . . . . . . . . . . . . . . . . . . . . 234 c clk_cpucr . . . . . . . . . . . . . . . . . . . . . . . . . . 61 clk_dithercr . . . . . . . . . . . . . . . . . . . . . . . 60 clk_hsecompr . . . . . . . . . . . . . . . . . . . . . . 58 clk_hsecr1 . . . . . . . . . . . . . . . . . . . . . . . . . 57 clk_hsecr2 . . . . . . . . . . . . . . . . . . . . . . . . . 60 clk_hsicr . . . . . . . . . . . . . . . . . . . . . . . . . . . 58 clk_lsi10kcr . . . . . . . . . . . . . . . . . . . . . . . . 56 clk_lsi1kcr . . . . . . . . . . . . . . . . . . . . . . . . . 57 clk_periodcr . . . . . . . . . . . . . . . . . . . . . . . 59 clk_periodsr . . . . . . . . . . . . . . . . . . . . . . . 59 clk_sleepcr . . . . . . . . . . . . . . . . . . . . . . . . 56 d dma_protr1 . . . . . . . . . . . . . . . . . . . . . . . . 39 dma_protr2 . . . . . . . . . . . . . . . . . . . . . . . . 39 e exti_pr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 104 extix_cr . . . . . . . . . . . . . . . . . . . . . . . . . . . 105 extix_tsr . . . . . . . . . . . . . . . . . . . . . . . . . . 104 g gpio_dbgcr . . . . . . . . . . . . . . . . . . . . . . . . 106 gpio_dbgsr . . . . . . . . . . . . . . . . . . . . . . . . 106 gpio_pctracecr . . . . . . . . . . . . . . . . . . . 105 gpiox_brr . . . . . . . . . . . . . . . . . . . . . . . . . 103 gpiox_bsr . . . . . . . . . . . . . . . . . . . . . . . . . . 103 gpiox_crh . . . . . . . . . . . . . . . . . . . . . . . . . 101 gpiox_crl . . . . . . . . . . . . . . . . . . . . . . . . . . 100 gpiox_idr . . . . . . . . . . . . . . . . . . . . . . . . . . 102 gpiox_odr . . . . . . . . . . . . . . . . . . . . . . . . . 102
docid16252 rev 15 283/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz index 284 m mactmr_cntr . . . . . . . . . . . . . . . . . . . . . . . 64 mactmr_cr . . . . . . . . . . . . . . . . . . . . . . . . . 64 mgmt_ier . . . . . . . . . . . . . . . . . . . . . . . . . . 243 mgmt_isr . . . . . . . . . . . . . . . . . . . . . . . . . . 242 p pwr_cpwrupreqsr . . . . . . . . . . . . . . . . . 81 pwr_csyspwrupackcr . . . . . . . . . . . . . . 83 pwr_csyspwrupacksr . . . . . . . . . . . . . . 82 pwr_csyspwrupreqsr . . . . . . . . . . . . . 82 pwr_dsleepcr1 . . . . . . . . . . . . . . . . . . . . . 77 pwr_dsleepcr2 . . . . . . . . . . . . . . . . . . . . . 78 pwr_vregcr . . . . . . . . . . . . . . . . . . . . . . . . 78 pwr_wakecr1 . . . . . . . . . . . . . . . . . . . . . . . 79 pwr_wakecr2 . . . . . . . . . . . . . . . . . . . . . . . 80 pwr_wakefiltr . . . . . . . . . . . . . . . . . . . . . 86 pwr_wakepar . . . . . . . . . . . . . . . . . . . . . . 83 pwr_wakepbr . . . . . . . . . . . . . . . . . . . . . . 84 pwr_wakepcr . . . . . . . . . . . . . . . . . . . . . . 85 pwr_wakesr . . . . . . . . . . . . . . . . . . . . . . . . 80 r ram_cr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 40 ram_protrx . . . . . . . . . . . . . . . . . . . . . . . . 38 rst_sr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 51 s sc1_uartbrr1 . . . . . . . . . . . . . . . . . . . . . 142 sc1_uartbrr2 . . . . . . . . . . . . . . . . . . . . . 143 sc1_uartcr . . . . . . . . . . . . . . . . . . . . . . . . 141 sc1_uartsr . . . . . . . . . . . . . . . . . . . . . . . . 140 scx_cr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 scx_crr1 . . . . . . . . . . . . . . . . . . . . . . . . . . 134 scx_crr2 . . . . . . . . . . . . . . . . . . . . . . . . . . 134 scx_dmacr . . . . . . . . . . . . . . . . . . . . . . . . . 152 scx_dmarxbegaddar . . . . . . . . . . . . . . . 144 scx_dmarxbegaddbr . . . . . . . . . . . . . . . 145 scx_dmarxcntar . . . . . . . . . . . . . . . . . . . 148 scx_dmarxcntbr . . . . . . . . . . . . . . . . . . . 148 scx_dmarxcntsavedr . . . . . . . . . . . . . . 154 scx_dmarxendaddar . . . . . . . . . . . . . . . 144 scx_dmarxendaddbr . . . . . . . . . . . . . . . 145 scx_dmarxerrar . . . . . . . . . . . . . . . . . . 153 scx_dmarxerrbr . . . . . . . . . . . . . . . . . . 153 scx_dmasr . . . . . . . . . . . . . . . . . . . . . . . . . 150 scx_dmatxbegaddar . . . . . . . . . . . . . . . 146 scx_dmatxbegaddbr . . . . . . . . . . . . . . . 147 scx_dmatxcntr . . . . . . . . . . . . . . . . . . . . 149
index stm32w108hb stm32w108cc stm32w108cb stm32w108cz 284/285 docid16252 rev 15 scx_dmatxendaddar . . . . . . . . . . . . . . . 146 scx_dmatxendaddbr . . . . . . . . . . . . . . . 147 scx_dr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133 scx_i2ccr1 . . . . . . . . . . . . . . . . . . . . . . . . . 138 scx_i2ccr2 . . . . . . . . . . . . . . . . . . . . . . . . . 139 scx_i2csr . . . . . . . . . . . . . . . . . . . . . . . . . . 137 scx_icr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 132 scx_ier . . . . . . . . . . . . . . . . . . . . . . . . . . . . 130 scx_isr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 128 scx_spicr . . . . . . . . . . . . . . . . . . . . . . . . . . 136 scx_spisr . . . . . . . . . . . . . . . . . . . . . . . . . . 135 slptmr_cmpah . . . . . . . . . . . . . . . . . . . . . . 68 slptmr_cmpal . . . . . . . . . . . . . . . . . . . . . . 69 slptmr_cmpbh . . . . . . . . . . . . . . . . . . . . . . 69 slptmr_cmpbl . . . . . . . . . . . . . . . . . . . . . . 70 slptmr_cnth . . . . . . . . . . . . . . . . . . . . . . . 67 slptmr_cntl . . . . . . . . . . . . . . . . . . . . . . . . 68 slptmr_cr . . . . . . . . . . . . . . . . . . . . . . . . . . 66 slptmr_ier . . . . . . . . . . . . . . . . . . . . . . . . . 71 slptmr_ifr . . . . . . . . . . . . . . . . . . . . . . . . . 71 slptmr_isr . . . . . . . . . . . . . . . . . . . . . . . . . 70 t tim1_or . . . . . . . . . . . . . . . . . . . . . . . . . . . . 217 tim2_or . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218 timx_arr . . . . . . . . . . . . . . . . . . . . . . . . . . . 215 timx_ccer . . . . . . . . . . . . . . . . . . . . . . . . . . 213 timx_ccmr1 . . . . . . . . . . . . . . . . . . . . . . . . 205 timx_ccmr2 . . . . . . . . . . . . . . . . . . . . . . . . 209 timx_ccr1 . . . . . . . . . . . . . . . . . . . . . . . . . . 215 timx_ccr2 . . . . . . . . . . . . . . . . . . . . . . . . . . 216 timx_ccr3 . . . . . . . . . . . . . . . . . . . . . . . . . . 216 timx_ccr4 . . . . . . . . . . . . . . . . . . . . . . . . . . 217 timx_cnt . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 timx_cr1 . . . . . . . . . . . . . . . . . . . . . . . . . . . 198 timx_cr2 . . . . . . . . . . . . . . . . . . . . . . . . . . . 200 timx_egr . . . . . . . . . . . . . . . . . . . . . . . . . . . 204 timx_ier . . . . . . . . . . . . . . . . . . . . . . . . . . . . 197 timx_missr . . . . . . . . . . . . . . . . . . . . . . . . . 197 timx_psc . . . . . . . . . . . . . . . . . . . . . . . . . . . 214 timx_smcr . . . . . . . . . . . . . . . . . . . . . . . . . 201 timx_sr . . . . . . . . . . . . . . . . . . . . . . . . . . . . 196 w wdg_cr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 wdg_kicksr . . . . . . . . . . . . . . . . . . . . . . . . . 66 wdg_kr . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65
docid16252 rev 15 285/285 stm32w108hb stm32w108cc stm32w108cb stm32w108cz 285 please read carefully: information in this document is provided solely in connection with st products. stmicroelectronics nv and its subsidiaries (?st ?) reserve the right to make changes, corrections, modifications or improvements, to this document, and the products and services described he rein at any time, without notice. all st products are sold pursuant to st?s terms and conditions of sale. purchasers are solely responsible for the choice, selection and use of the st products and services described herein, and st as sumes no liability whatsoever relating to the choice, selection or use of the st products and services described herein. no license, express or implied, by estoppel or otherwise, to any intellectual property rights is granted under this document. i f any part of this document refers to any third party products or services it shall not be deemed a license grant by st for the use of such third party products or services, or any intellectual property contained therein or considered as a warranty covering the use in any manner whatsoev er of such third party products or services or any intellectual property contained therein. unless otherwise set forth in st?s terms and conditions of sale st disclaims any express or implied warranty with respect to the use and/or sale of st products including without limitation implied warranties of merchantability, fitness for a particul ar purpose (and their equivalents under the laws of any jurisdiction), or infringement of any patent, copyright or other intellectual property right. st products are not designed or authorized for use in: (a) safety critical applications such as life supporting, active implanted devices or systems with product functional safety requirements; (b) aeronautic applications; (c) automotive applications or environments, and/or (d) aerospace applications or environments. where st products are not designed for such use, the purchaser shall use products at purchaser?s sole risk, even if st has been informed in writing of such usage, unless a product is expressly designated by st as being intended for ? automotive, automotive safe ty or medical? industry domains according to st product design specifications. products formally escc, qml or jan qualified are deemed suitable for use in aerospace by the corresponding governmental agency. resale of st products with provisions different from the statements and/or technical features set forth in this document shall immediately void any warranty granted by st for the st product or service described herein and shall not create or extend in any manner whatsoev er, any liability of st. st and the st logo are trademarks or registered trademarks of st in various countries. information in this document supersedes and replaces all information previously supplied. the st logo is a registered trademark of stmicroelectronics. all other names are the property of their respective owners. ? 2013 stmicroelectronics - all rights reserved stmicroelectronics group of companies australia - belgium - brazil - canada - china - czech republic - finland - france - germany - hong kong - india - israel - ital y - japan - malaysia - malta - morocco - philippines - singapore - spain - sweden - switzerland - united kingdom - united states of america www.st.com


▲Up To Search▲   

 
Price & Availability of STM32W108CCU75TR

All Rights Reserved © IC-ON-LINE 2003 - 2022  

[Add Bookmark] [Contact Us] [Link exchange] [Privacy policy]
Mirror Sites :  [www.datasheet.hk]   [www.maxim4u.com]  [www.ic-on-line.cn] [www.ic-on-line.com] [www.ic-on-line.net] [www.alldatasheet.com.cn] [www.gdcy.com]  [www.gdcy.net]


 . . . . .
  We use cookies to deliver the best possible web experience and assist with our advertising efforts. By continuing to use this site, you consent to the use of cookies. For more information on cookies, please take a look at our Privacy Policy. X